linux/arch/s390
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
..
appldata s390: appldata: drop owner assignment from platform_drivers 2014-10-20 16:20:13 +02:00
boot s390/boot: fix boot of compressed kernel built with gcc 4.9 2014-05-27 10:26:04 +02:00
configs s390: update default configuration 2014-10-27 13:27:03 +01:00
crypto crypto: prefix module autoloading with "crypto-" 2014-11-24 22:43:57 +08:00
hypfs s390/timex: fix get_tod_clock_ext() inline assembly 2015-01-07 09:52:47 +01:00
include Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2015-01-15 10:50:29 +13:00
kernel Surprising number of fixes this merge window :( 2015-01-23 06:40:36 +12:00
kvm kernel: Provide READ_ONCE and ASSIGN_ONCE 2014-12-20 16:48:59 -08:00
lib s390/uprobes: fix kprobes dependency 2014-10-17 14:45:51 +02:00
math-emu s390: fix save and restore of the floating-point-control register 2013-10-24 17:17:11 +02:00
mm vm: add VM_FAULT_SIGSEGV handling support 2015-01-29 10:51:32 -08:00
net s390/bpf: Zero extend parameters before calling C function 2015-01-15 11:10:41 +01:00
oprofile s390: Replace __get_cpu_var uses 2014-08-26 13:45:52 -04:00
pci Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2014-12-11 17:30:55 -08:00
defconfig s390: update default configuration 2014-10-27 13:27:03 +01:00
Kbuild s390/pci: base support 2012-11-30 15:40:45 +01:00
Kconfig gcov: enable GCOV_PROFILE_ALL from ARCH Kconfigs 2014-12-13 12:42:51 -08:00
Kconfig.debug Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 2013-04-30 17:04:09 -07:00
Makefile s390: pass march flag to assembly files as well 2014-09-09 08:53:28 +02:00