[ Adding 'linux-arch' to the recipients, since this touches pretty
much all architectures ]
Background for arch people: it seems that a few applications really
care about the difference between SIGSEGV and SIGBUS, but the generic
VM layer currently has no way to say "this access should generate a
SIGSEGV". We have that VM_FAULT_SIGBUS, but no equivalent
VM_FAULT_SIGSEGV.
So when the stack limit fix went in, I used VM_FAULT_SIGBUS, and a
couple of apps noticed that the stack rlimit violation changed from
SIGSEGV to SIGBUS as a result.
It's actually sad that this whole error handling is duplicated all
over every architecture, but oh well. This is a completely mindless
patch to add VM_FAULT_SIGSEGV.
Some architectures aren't affected, for the simple reason that they
already ended up returning SIGSEGV for non-SIGBUS errors. Most other
architectures had a BUG_ON() for the unrecognized case, and just need
a trivial "if (fault & VM_FAULT_SIGSEGV) goto bad_area;"
And then some architectures had a different pattern, and I tried to
fix it up as straightforwardly as possible, but I could easily have
screwed up.
Can people take a look?
On Tue, Jan 27, 2015 at 12:36 PM, Linus Torvalds
Very annoying. The patch would look something like the attached - TOTALLY UNTESTED.
Actually, I missed a couple of places in mm/gup.c and mm/ksm.c (and one in lustre, although that one just uses filemap_fault, so it never triggers the stack case, but for completeness). So this would be the more complete patch. Still totally untested. I may have screwed up something obvious. Linus