]> www.infradead.org Git - users/jedix/linux-maple.git/commit
userfaultfd: allow signals to interrupt a userfault
authorAndrea Arcangeli <aarcange@redhat.com>
Fri, 4 Sep 2015 22:47:18 +0000 (15:47 -0700)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 18:53:12 +0000 (13:53 -0500)
commit5d989ca0b560d4db11a5c2c6ed8c3b35ab223226
tree5e45c05714ae34cc352a60b1ce6494da7021025d
parent4357fe9bc25fa1397f1cd56ba05bfb1f5f46ec5e
userfaultfd: allow signals to interrupt a userfault

Orabug: 21685254

This is only simple to achieve if the userfault is going to return to
userland (not to the kernel) because we can avoid returning VM_FAULT_RETRY
despite we temporarily released the mmap_sem.  The fault would just be
retried by userland then.  This is safe at least on x86 and powerpc (the
two archs with the syscall implemented so far).

Hint to verify for which archs this is safe: after handle_mm_fault
returns, no access to data structures protected by the mmap_sem must be
done by the fault code in arch/*/mm/fault.c until up_read(&mm->mmap_sem)
is called.

This has two main benefits: signals can run with lower latency in
production (signals aren't blocked by userfaults and userfaults are
immediately repeated after signal processing) and gdb can then trivially
debug the threads blocked in this kind of userfaults coming directly from
userland.

On a side note: while gdb has a need to get signal processed, coredumps
always worked perfectly with userfaults, no matter if the userfault is
triggered by GUP a kernel copy_user or directly from userland.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit dfa37dc3fc1f6f81a6900d0e561c02362f4817f6)
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/userfaultfd.c