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@yahoo.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2013-06-03 04:32:53 +00:00
parent 91ddaeb725
commit 1e65d73c74
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251285

View File

@ -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);