]> Git Repo - linux.git/commitdiff
parisc: fix livelock in uaccess
authorAl Viro <[email protected]>
Tue, 31 Jan 2023 04:53:52 +0000 (23:53 -0500)
committerAl Viro <[email protected]>
Thu, 2 Mar 2023 17:31:40 +0000 (12:31 -0500)
parisc equivalent of 26178ec11ef3 "x86: mm: consolidate VM_FAULT_RETRY handling"
If e.g. get_user() triggers a page fault and a fatal signal is caught, we might
end up with handle_mm_fault() returning VM_FAULT_RETRY and not doing anything
to page tables.  In such case we must *not* return to the faulting insn -
that would repeat the entire thing without making any progress; what we need
instead is to treat that as failed (user) memory access.

Tested-by: Helge Deller <[email protected]>
Signed-off-by: Al Viro <[email protected]>
arch/parisc/mm/fault.c

index 869204e97ec9d7926e948e3274f7b4d96eb56181..6941fdbf251738c8158e4da736d21033379a4766 100644 (file)
@@ -308,8 +308,13 @@ good_area:
 
        fault = handle_mm_fault(vma, address, flags, regs);
 
-       if (fault_signal_pending(fault, regs))
+       if (fault_signal_pending(fault, regs)) {
+               if (!user_mode(regs)) {
+                       msg = "Page fault: fault signal on kernel memory";
+                       goto no_context;
+               }
                return;
+       }
 
        /* The fault is fully completed (including releasing mmap lock) */
        if (fault & VM_FAULT_COMPLETED)
This page took 0.054401 seconds and 4 git commands to generate.