freebsd-skq/sys/amd64
kib 957270782d Improve MD page fault handlers.
Centralize calculation of signal and ucode delivered on unhandled page
fault in new function vm_fault_trap().  MD trap_pfault() now almost
always uses the signal numbers and error codes calculated in
consistent MI way.

This introduces the protection fault compatibility sysctls to all
non-x86 architectures which did not have that bug, but apparently they
were already much more wrong in selecting delivered signals on
protection violations.

Change the delivered signal for accesses to mapped area after the
backing object was truncated.  According to POSIX description for
mmap(2):
   The system shall always zero-fill any partial page at the end of an
   object. Further, the system shall never write out any modified
   portions of the last page of an object which are beyond its
   end. References within the address range starting at pa and
   continuing for len bytes to whole pages following the end of an
   object shall result in delivery of a SIGBUS signal.

   An implementation may generate SIGBUS signals when a reference
   would cause an error in the mapped object, such as out-of-space
   condition.
Adjust according to the description, keeping the existing
compatibility code for SIGSEGV/SIGBUS on protection failures.

For situations where kernel cannot handle page fault due to resource
limit enforcement, SIGBUS with a new error code BUS_OBJERR is
delivered.  Also, provide a new error code SEGV_PKUERR for SIGSEGV on
amd64 due to protection key access violation.

vm_fault_hold() is renamed to vm_fault().  Fixed some nits in
trap_pfault()s like mis-interpreting Mach errors as errnos.  Removed
unneeded truncations of the fault addresses reported by hardware.

PR:	211924
Reviewed by:	alc
Discussed with:	jilles, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21566
2019-09-27 18:43:36 +00:00
..
acpica Merge ACPICA 20190329. 2019-03-29 20:21:28 +00:00
amd64 Improve MD page fault handlers. 2019-09-27 18:43:36 +00:00
cloudabi32 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
cloudabi64 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
conf Start to split out the really x86 specific NOTES from the global notes file. 2019-08-12 22:58:13 +00:00
ia32 Don't pass error from syscallenter() to syscallret(). 2019-07-15 21:25:16 +00:00
include Revert r352406, which contained changes I didn't intend to commit. 2019-09-16 15:04:45 +00:00
linux sysent: regenerate after r352693 2019-09-25 17:30:28 +00:00
linux32 sysent: regenerate after r352693 2019-09-25 17:30:28 +00:00
pci pci_cfgreg.c: Use io port config access for early boot time. 2019-04-09 18:07:17 +00:00
sgx Change synchonization rules for vm_page reference counting. 2019-09-09 21:32:42 +00:00
vmm Improve MD page fault handlers. 2019-09-27 18:43:36 +00:00
Makefile