[lkml]   [2019]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v5 09/16] mm: Return faster for non-fatal signals in user mode faults
The idea comes from the upstream discussion between Linus and Andrea:

A summary to the issue: there was a special path in handle_userfault()
in the past that we'll return a VM_FAULT_NOPAGE when we detected
non-fatal signals when waiting for userfault handling. We did that by
reacquiring the mmap_sem before returning. However that brings a risk
in that the vmas might have changed when we retake the mmap_sem and
even we could be holding an invalid vma structure.

This patch is a preparation of removing that special path by allowing
the page fault to return even faster if we were interrupted by a
non-fatal signal during a user-mode page fault handling routine.

Suggested-by: Linus Torvalds <>
Suggested-by: Andrea Arcangeli <>
Signed-off-by: Peter Xu <>
include/linux/sched/signal.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 46429192733b..031af0a6505a 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -387,7 +387,8 @@ static inline bool fault_signal_pending(unsigned int fault_flags,
struct pt_regs *regs)
return unlikely((fault_flags & VM_FAULT_RETRY) &&
- fatal_signal_pending(current));
+ (fatal_signal_pending(current) ||
+ (user_mode(regs) && signal_pending(current))));

 \ /
  Last update: 2019-09-26 11:41    [W:0.090 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site