freebsd-skq/sys/vm
kib 24c4e4a548 Fix two issues with /dev/mem access on amd64, both causing kernel page
faults.

First, for accesses to direct map region should check for the limit by
which direct map is instantiated.

Second, for accesses to the kernel map, success returned from the
kernacc(9) does not guarantee that consequent attempt to read or write
to the checked address succeed, since other thread might invalidate
the address meantime.  Add a new thread private flag TDP_DEVMEMIO,
which instructs vm_fault() to return error when fault happens on the
MAP_ENTRY_NOFAULT entry, instead of panicing.  The trap handler would
then see a page fault from access, and recover in normal way, making
/dev/mem access safer.

Remove GIANT_REQUIRED from the amd64 memrw(), since it is not needed
and having Giant locked does not solve issues for amd64.

Note that at least the second issue exists on other architectures, and
requires similar patching for md code.

Reported and tested by:	clusteradm (gjb, sbruno)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-03-21 14:25:09 +00:00
..
_vm_radix.h
default_pager.c
device_pager.c Initialize paddr to handle the case of zero size. 2014-03-12 16:38:55 +00:00
memguard.c
memguard.h
phys_pager.c
pmap.h
redzone.c
redzone.h
sg_pager.c
swap_pager.c vm_page_grab() and vm_pager_get_pages() can drop the vm_object lock, 2014-03-19 01:13:42 +00:00
swap_pager.h
uma_core.c
uma_dbg.c
uma_dbg.h
uma_int.h
uma.h
vm_extern.h
vm_fault.c Fix two issues with /dev/mem access on amd64, both causing kernel page 2014-03-21 14:25:09 +00:00
vm_glue.c
vm_init.c
vm_kern.c
vm_kern.h
vm_map.c Initialize vm_map_entry member wiring_thread on the map entry creation. 2014-03-21 13:55:57 +00:00
vm_map.h
vm_meter.c
vm_mmap.c Update kernel inclusions of capability.h to use capsicum.h instead; some 2014-03-16 10:55:57 +00:00
vm_object.c Do not vdrop() the tmpfs vnode until it is unlocked. The hold 2014-03-12 15:13:57 +00:00
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_radix.c
vm_radix.h
vm_reserv.c
vm_reserv.h
vm_unix.c
vm_zeroidle.c
vm.h
vnode_pager.c
vnode_pager.h