xtensa: fix uaccess-related livelock in do_page_fault
Subsystems (2)
Max Filippov
maintainerPATCH 1/1 xtensa: fix uaccess-related livelock in do_page_fault
If a uaccess (e.g. get_user()) triggers a fault and there's a fault signal pending, the handler will return to the uaccess without having performed a uaccess fault fixup, and so the CPU will immediately execute the uaccess instruction again, whereupon it will livelock bouncing between that instruction and the fault handler.
https://lore.kernel.org/lkml/[email protected]/
Reported-by Mark Rutland <[email protected]>
Signed-off-by Max Filippov <[email protected]>
--- arch/xtensa/mm/fault.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/xtensa/mm/fault.c +4 -1
@@ -112,8 +112,11 @@ void do_page_fault(struct pt_regs *regs)*/ fault =handle_mm_fault (vma, address, flags, regs); -if (fault_signal_pending (fault, regs)) +if (fault_signal_pending (fault, regs)) { +if (!user_mode (regs)) + goto bad_page_fault;return ; + }if (unlikely (fault &VM_FAULT_ERROR )) {if (fault &VM_FAULT_OOM )
Signature · 1 line
2.20.1