Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Nov 2018 21:57:03 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340205 - in head/sys: kern vm
Message-ID:  <201811062157.wA6Lv3b2011196@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Nov  6 21:57:03 2018
New Revision: 340205
URL: https://svnweb.freebsd.org/changeset/base/340205

Log:
  Avoid specifying VM_PROT_EXECUTE in mappings from pipe_map and exec_map.
  
  These submaps are used for mapping pipe buffers and execv() argument
  strings respectively, so there's no need for such mappings to have
  execute permissions.
  
  Reported by:	jhb
  Reviewed by:	alc, jhb, kib
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D17827

Modified:
  head/sys/kern/sys_pipe.c
  head/sys/vm/vm_kern.c

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Tue Nov  6 21:49:50 2018	(r340204)
+++ head/sys/kern/sys_pipe.c	Tue Nov  6 21:57:03 2018	(r340205)
@@ -509,9 +509,8 @@ retry:
 	size = round_page(size);
 	buffer = (caddr_t) vm_map_min(pipe_map);
 
-	error = vm_map_find(pipe_map, NULL, 0,
-		(vm_offset_t *) &buffer, size, 0, VMFS_ANY_SPACE,
-		VM_PROT_ALL, VM_PROT_ALL, 0);
+	error = vm_map_find(pipe_map, NULL, 0, (vm_offset_t *)&buffer, size, 0,
+	    VMFS_ANY_SPACE, VM_PROT_RW, VM_PROT_RW, 0);
 	if (error != KERN_SUCCESS) {
 		if ((cpipe->pipe_buffer.buffer == NULL) &&
 			(size > SMALL_PIPE_SIZE)) {

Modified: head/sys/vm/vm_kern.c
==============================================================================
--- head/sys/vm/vm_kern.c	Tue Nov  6 21:49:50 2018	(r340204)
+++ head/sys/vm/vm_kern.c	Tue Nov  6 21:57:03 2018	(r340205)
@@ -650,8 +650,8 @@ kmap_alloc_wait(vm_map_t map, vm_size_t size)
 		map->needs_wakeup = TRUE;
 		vm_map_unlock_and_wait(map, 0);
 	}
-	vm_map_insert(map, NULL, 0, addr, addr + size, VM_PROT_ALL,
-	    VM_PROT_ALL, MAP_ACC_CHARGED);
+	vm_map_insert(map, NULL, 0, addr, addr + size, VM_PROT_RW, VM_PROT_RW,
+	    MAP_ACC_CHARGED);
 	vm_map_unlock(map);
 	return (addr);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811062157.wA6Lv3b2011196>