linux/arch/powerpc/mm
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
..
40x_mmu.c
44x_mmu.c powerpc: Delete __cpuinit usage from all users 2013-07-01 11:10:36 +10:00
copro_fault.c vm: add VM_FAULT_SIGSEGV handling support 2015-01-29 10:51:32 -08:00
dma-noncoherent.c lib/scatterlist: make ARCH_HAS_SG_CHAIN an actual Kconfig 2014-08-08 15:57:26 -07:00
fault.c vm: add VM_FAULT_SIGSEGV handling support 2015-01-29 10:51:32 -08:00
fsl_booke_mmu.c powerpc/e6500: TLB miss handler with hardware tablewalk support 2014-01-09 17:52:19 -06:00
hash_low_32.S powerpc: Use CURRENT_THREAD_INFO instead of open coded assembly 2012-07-11 14:18:22 +10:00
hash_low_64.S powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault 2014-12-05 16:26:15 +11:00
hash_native_64.c powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault 2014-12-05 16:26:15 +11:00
hash_utils_64.c mm/debug-pagealloc: make debug-pagealloc boottime configurable 2014-12-13 12:42:48 -08:00
highmem.c
hugepage-hash64.c powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault 2014-12-05 16:26:15 +11:00
hugetlbpage-book3e.c powerpc: Replace __get_cpu_var uses 2014-11-03 12:12:32 +11:00
hugetlbpage-hash64.c powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault 2014-12-05 16:26:15 +11:00
hugetlbpage.c powerpc updates for 3.19 2014-12-11 17:48:14 -08:00
icswx_pid.c powerpc: Split ICSWX ACOP and PID processing 2011-11-25 14:11:27 +11:00
icswx.c powerpc: Fix typo "CONFIG_ICSWX_PID" 2013-04-18 13:03:54 +10:00
icswx.h powerpc/icswx: Fix race condition with IPI setting ACOP 2012-03-07 17:06:09 +11:00
init_32.c powerpc: Remove superfluous bootmem includes 2014-11-10 09:59:26 +11:00
init_64.c powerpc: Remove superfluous bootmem includes 2014-11-10 09:59:26 +11:00
Makefile powerpc/mm: Switch to generic RCU get_user_pages_fast 2014-11-14 17:24:21 +11:00
mem.c powerpc: Move sparse_init() into initmem_init 2014-11-10 09:59:26 +11:00
mmap.c mm: remove free_area_cache 2013-07-10 18:11:34 -07:00
mmu_context_hash32.c powerpc: Remove power3 from comments 2014-07-28 14:10:26 +10:00
mmu_context_hash64.c powerpc: Reduce PTE table memory wastage 2013-04-30 16:00:07 +10:00
mmu_context_nohash.c powerpc: Remove more traces of bootmem 2014-11-19 21:41:51 +11:00
mmu_decl.h powerpc: Fix comment typo 'CONIFG_8xx' 2014-10-29 14:42:08 +01:00
numa.c powerpc updates for 3.19 2014-12-11 17:48:14 -08:00
pgtable_32.c mm/debug-pagealloc: make debug-pagealloc boottime configurable 2014-12-13 12:42:48 -08:00
pgtable_64.c powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault 2014-12-05 16:26:15 +11:00
pgtable.c powerpc: Make a bunch of things static 2014-09-25 23:14:41 +10:00
ppc_mmu_32.c powerpc: Remove power3 from comments 2014-07-28 14:10:26 +10:00
slb_low.S Merge remote-tracking branch 'anton/abiv2' into next 2014-05-05 20:57:12 +10:00
slb.c powerpc/cell: Move data segment faulting code out of cell platform 2014-10-08 20:14:55 +11:00
slice.c powerpc/mm: Fix build error with hugetlfs disabled 2014-10-22 14:03:06 +11:00
subpage-prot.c powerpc/mm: Add new "set" flag argument to pte/pmd update function 2014-02-17 11:19:35 +11:00
tlb_hash32.c powerpc: include export.h for files using EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:30:38 -04:00
tlb_hash64.c powerpc/thp: Add tracepoints to track hugepage invalidate 2014-08-13 18:20:42 +10:00
tlb_low_64e.S powerpc/e6500: Work around erratum A-008139 2014-07-29 19:26:29 -05:00
tlb_nohash_low.S powerpc/fsl_booke: smp support for booting a relocatable kernel above 64M 2014-01-09 17:52:18 -06:00
tlb_nohash.c powerpc/nohash: Split __early_init_mmu() into boot and secondary 2014-08-13 15:13:25 +10:00