Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: fix livelock in uaccess

m68k 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: Finn Thain <fthain@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro bd75497a c9c3395d

+4 -1
+4 -1
arch/m68k/mm/fault.c
··· 138 138 fault = handle_mm_fault(vma, address, flags, regs); 139 139 pr_debug("handle_mm_fault returns %x\n", fault); 140 140 141 - if (fault_signal_pending(fault, regs)) 141 + if (fault_signal_pending(fault, regs)) { 142 + if (!user_mode(regs)) 143 + goto no_context; 142 144 return 0; 145 + } 143 146 144 147 /* The fault is fully completed (including releasing mmap lock) */ 145 148 if (fault & VM_FAULT_COMPLETED)