From: Peter Xu <pet...@redhat.com>

This patch removes the risk path in handle_userfault() then we will be
sure that the callers of handle_mm_fault() will know that the VMAs might
have changed.  Meanwhile with previous patch we don't lose responsiveness
as well since the core mm code now can handle the nonfatal userspace
signals even if we return VM_FAULT_RETRY.

Suggested-by: Andrea Arcangeli <aarca...@redhat.com>
Suggested-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Peter Xu <pet...@redhat.com>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Tested-by: Brian Geffon <bgef...@google.com>
Reviewed-by: Jerome Glisse <jgli...@redhat.com>
Cc: Bobby Powers <bobbypow...@gmail.com>
Cc: David Hildenbrand <da...@redhat.com>
Cc: Denis Plotnikov <dplotni...@virtuozzo.com>
Cc: "Dr . David Alan Gilbert" <dgilb...@redhat.com>
Cc: Hugh Dickins <hu...@google.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: "Kirill A . Shutemov" <kir...@shutemov.name>
Cc: Martin Cracauer <craca...@cons.org>
Cc: Marty McFadden <mcfadd...@llnl.gov>
Cc: Matthew Wilcox <wi...@infradead.org>
Cc: Maya Gokhale <gokha...@llnl.gov>
Cc: Mel Gorman <mgor...@suse.de>
Cc: Mike Kravetz <mike.krav...@oracle.com>
Cc: Mike Rapoport <r...@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <xe...@openvz.org>
Link: http://lkml.kernel.org/r/20200220160234.9646-1-pet...@redhat.com
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>

https://jira.sw.ru/browse/PSBM-102938
(cherry picked from commit ef429ee7409aa7cbe4c3c9e2df5dc6abedfab493)
Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 fs/userfaultfd.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 2dcade9daa73..905bad9139bb 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -517,30 +517,6 @@ int handle_userfault(struct vm_fault *vmf, unsigned long 
reason)
 
        __set_current_state(TASK_RUNNING);
 
-       if (return_to_userland) {
-               if (signal_pending(current) &&
-                   !fatal_signal_pending(current)) {
-                       /*
-                        * If we got a SIGSTOP or SIGCONT and this is
-                        * a normal userland page fault, just let
-                        * userland return so the signal will be
-                        * handled and gdb debugging works.  The page
-                        * fault code immediately after we return from
-                        * this function is going to release the
-                        * mmap_sem and it's not depending on it
-                        * (unlike gup would if we were not to return
-                        * VM_FAULT_RETRY).
-                        *
-                        * If a fatal signal is pending we still take
-                        * the streamlined VM_FAULT_RETRY failure path
-                        * and there's no need to retake the mmap_sem
-                        * in such case.
-                        */
-                       down_read(&mm->mmap_sem);
-                       ret = VM_FAULT_NOPAGE;
-               }
-       }
-
        /*
         * Here we race with the list_del; list_add in
         * userfaultfd_ctx_read(), however because we don't ever run
-- 
2.25.3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to