HardenedBSD/sys/vm
Konstantin Belousov 84110e7e0b Account the writeable shared mappings backed by file in the vnode
v_writecount.  Keep the amount of the virtual address space used by
the mappings in the new vm_object un_pager.vnp.writemappings
counter. The vnode v_writecount is incremented when writemappings gets
non-zero value, and decremented when writemappings is returned to
zero.

Writeable shared vnode-backed mappings are accounted for in vm_mmap(),
and vm_map_insert() is instructed to set MAP_ENTRY_VN_WRITECNT flag on
the created map entry.  During deferred map entry deallocation,
vm_map_process_deferred() checks for MAP_ENTRY_VN_WRITECOUNT and
decrements writemappings for the vm object.

Now, the writeable mount cannot be demoted to read-only while
writeable shared mappings of the vnodes from the mount point
exist. Also, execve(2) fails for such files with ETXTBUSY, as it
should be.

Noted by:	tegge
Reviewed by:	tegge (long time ago, early version), alc
Tested by:	pho
MFC after:	3 weeks
2012-02-23 21:07:16 +00:00
..
default_pager.c
device_pager.c
memguard.c
memguard.h
phys_pager.c
pmap.h
redzone.c
redzone.h
sg_pager.c
swap_pager.c
swap_pager.h
uma_core.c
uma_dbg.c
uma_dbg.h
uma_int.h
uma.h
vm_contig.c
vm_extern.h
vm_fault.c
vm_glue.c
vm_init.c
vm_kern.c
vm_kern.h
vm_map.c
vm_map.h
vm_meter.c
vm_mmap.c
vm_object.c
vm_object.h
vm_page.c
vm_page.h
vm_pageout.c
vm_pageout.h
vm_pager.c
vm_pager.h
vm_param.h
vm_phys.c
vm_phys.h
vm_reserv.c
vm_reserv.h
vm_unix.c
vm_zeroidle.c
vm.h
vnode_pager.c
vnode_pager.h