svn commit: r251285 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Jun 3 04:32:54 UTC 2013


Author: kib
Date: Mon Jun  3 04:32:53 2013
New Revision: 251285
URL: http://svnweb.freebsd.org/changeset/base/251285

Log:
  Do not map the shared page COW.  If the process wired its address
  space, fork(2) would cause shadowing of the physical object and
  copying of the shared page into private copy, effectively preventing
  updates for the exported timehands structure and stopping the clock.
  
  Specify the maximum allowed permissions for the page to be read and
  execute, preventing write from the user mode.
  
  Reported and tested by:	<huanghwh at yahoo.com>
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Mon Jun  3 04:22:42 2013	(r251284)
+++ head/sys/kern/kern_exec.c	Mon Jun  3 04:32:53 2013	(r251285)
@@ -1050,8 +1050,9 @@ exec_new_vmspace(imgp, sv)
 		vm_object_reference(obj);
 		error = vm_map_fixed(map, obj, 0,
 		    sv->sv_shared_page_base, sv->sv_shared_page_len,
-		    VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_ALL,
-		    MAP_COPY_ON_WRITE | MAP_ACC_NO_CHARGE);
+		    VM_PROT_READ | VM_PROT_EXECUTE,
+		    VM_PROT_READ | VM_PROT_EXECUTE,
+		    MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE);
 		if (error) {
 			vm_object_deallocate(obj);
 			return (error);


More information about the svn-src-head mailing list