freebsd-dev/sys/sparc64/sparc64
Konstantin Belousov df08823d07 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
..
ata_machdep.c
autoconf.c
bus_machdep.c
cache.c
cam_machdep.c
cheetah.c
clock.c
counter.c
db_disasm.c
db_hwwatch.c
db_interface.c
db_trace.c
dump_machdep.c Print the dump progress indicator after calling dump_start(). 2018-05-01 17:32:43 +00:00
eeprom.c
elf_machdep.c Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
exception.S Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
gdb_machdep.c
genassym.c
identcpu.c
in_cksum.c
interrupt.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
intr_machdep.c follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers 2018-07-23 15:36:55 +00:00
iommu.c
jbusppm.c
locore.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
machdep.c Plug memory disclosures via ptrace(2). 2018-12-03 20:54:17 +00:00
mem.c
mp_exception.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
mp_locore.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
mp_machdep.c Eliminate kmem_malloc()'s unused arena parameter. (The arena parameter 2018-08-21 16:43:46 +00:00
nexus.c Clean up OF_getprop_alloc API 2018-04-08 22:59:34 +00:00
ofw_machdep.c
pmap.c Revert r352406, which contained changes I didn't intend to commit. 2019-09-16 15:04:45 +00:00
prof_machdep.c
rtc.c
rwindow.c
sc_machdep.c
schppm.c
spitfire.c
ssm.c
stack_machdep.c
support.S Provide protection against starvation of the ll/sc loops when accessing userpace. 2019-07-12 18:43:24 +00:00
swtch.S Rename assym.s to assym.inc 2018-03-20 17:58:51 +00:00
sys_machdep.c
tick.c
tlb.c
trap.c Improve MD page fault handlers. 2019-09-27 18:43:36 +00:00
tsb.c
uio_machdep.c
upa.c Clean up OF_getprop_alloc API 2018-04-08 22:59:34 +00:00
vm_machdep.c Provide protection against starvation of the ll/sc loops when accessing userpace. 2019-07-12 18:43:24 +00:00
zeus.c