linux/drivers/staging
Linus Torvalds 33692f2759 vm: add VM_FAULT_SIGSEGV handling support
The core VM already knows about VM_FAULT_SIGBUS, but cannot return a
"you should SIGSEGV" error, because the SIGSEGV case was generally
handled by the caller - usually the architecture fault handler.

That results in lots of duplication - all the architecture fault
handlers end up doing very similar "look up vma, check permissions, do
retries etc" - but it generally works.  However, there are cases where
the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV.

In particular, when accessing the stack guard page, libsigsegv expects a
SIGSEGV.  And it usually got one, because the stack growth is handled by
that duplicated architecture fault handler.

However, when the generic VM layer started propagating the error return
from the stack expansion in commit fee7e49d45 ("mm: propagate error
from stack expansion even for guard page"), that now exposed the
existing VM_FAULT_SIGBUS result to user space.  And user space really
expected SIGSEGV, not SIGBUS.

To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those
duplicate architecture fault handlers about it.  They all already have
the code to handle SIGSEGV, so it's about just tying that new return
value to the existing code, but it's all a bit annoying.

This is the mindless minimal patch to do this.  A more extensive patch
would be to try to gather up the mostly shared fault handling logic into
one generic helper routine, and long-term we really should do that
cleanup.

Just from this patch, you can generally see that most architectures just
copied (directly or indirectly) the old x86 way of doing things, but in
the meantime that original x86 model has been improved to hold the VM
semaphore for shorter times etc and to handle VM_FAULT_RETRY and other
"newer" things, so it would be a good idea to bring all those
improvements to the generic case and teach other architectures about
them too.

Reported-and-tested-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Jan Engelhardt <jengelh@inai.de>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # "s390 still compiles and boots"
Cc: linux-arch@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-01-29 10:51:32 -08:00
..
android Merge branch 'for-3.19' of git://linux-nfs.org/~bfields/linux 2014-12-16 15:25:31 -08:00
board
clocking-wizard Drivers:staging:clocking-wizard: Added a newline 2014-12-02 16:45:24 -08:00
comedi staging: comedi: change some printk calls to pr_err 2014-12-02 16:54:43 -08:00
cptm1217 staging: cptm1217: Remove useless cast on void pointer 2014-10-30 13:05:46 -07:00
dgap Drivers:staging:dgap: Added a blank line after declaration 2014-11-26 14:00:22 -08:00
dgnc staging: dgnc: Remove useless cast on void pointer 2014-10-30 13:05:46 -07:00
emxx_udc Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
ft1000 staging: ft1000 : replace __attribute ((__packed__) with __packed 2014-12-02 16:48:10 -08:00
fwserial staging: fwserial: remove multiple blank lines 2014-11-26 13:53:25 -08:00
gdm72xx More ACPI and power management updates for 3.19-rc1 2014-12-18 20:28:33 -08:00
gdm724x
goldfish
gs_fpgaboot
iio Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
line6
lustre vm: add VM_FAULT_SIGSEGV handling support 2015-01-29 10:51:32 -08:00
media media fixes for v3.19-rc6 2015-01-24 14:34:54 -08:00
mt29f_spinand
netlogic
nvec
octeon Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
octeon-usb Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
olpc_dcon staging: olpc_dcon: Deletion of a check before backlight_device_unregister() 2014-11-26 14:00:22 -08:00
ozwpan Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
panel staging: panel: Move LCD-related state into struct lcd 2014-12-02 16:34:35 -08:00
rtl8188eu staging: rtl8188eu: hal: hal_intf.c: Cleaning up functions that are not used anywhere 2014-12-02 16:29:26 -08:00
rtl8192e drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c" 2014-12-02 16:47:11 -08:00
rtl8192u Staging: rtl8192u: Use put_unaligned_le16 2014-11-03 16:09:27 -08:00
rtl8712 staging: rtl8712: remove unnecessary else after return 2014-12-02 16:54:43 -08:00
rtl8723au Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
rts5208 staging: rts5208: Remove useless cast on void pointer 2014-10-30 13:06:03 -07:00
skein staging: skein: fix sparse warnings related to shift operator 2014-11-22 10:53:09 -08:00
slicoss Staging: slicoss: Fix long line issues in slicoss.c 2014-12-02 16:54:43 -08:00
speakup
ste_rmi4
unisys staging: unisys: remove duplicate header 2014-12-02 16:50:08 -08:00
vme
vt6655 staging: vt6655: fix sparse warning: argument type 2015-01-12 19:49:47 -08:00
vt6656 Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
wlan-ng staging: wlan-ng: prism2fw: fixed code style issue 2014-11-26 14:00:22 -08:00
xgifb staging: xgifb: Removed a definition which was not used in driver 2014-11-03 16:10:38 -08:00
Kconfig Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
Makefile Staging patches for 3.19-rc1 2014-12-15 18:06:13 -08:00
staging.c