Skip to content

Commit a3be911

Browse files
jcmvbkbcgregkh
authored andcommitted
xtensa: fix uaccess-related livelock in do_page_fault
commit 7b9acbb upstream. 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/20210121123140.GD48431@C02TD0UTHF1T.local/ Cc: stable@vger.kernel.org Reported-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bcd7999 commit a3be911

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎arch/xtensa/mm/fault.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ void do_page_fault(struct pt_regs *regs)
112112
*/
113113
fault = handle_mm_fault(vma, address, flags, regs);
114114

115-
if (fault_signal_pending(fault, regs))
115+
if (fault_signal_pending(fault, regs)) {
116+
if (!user_mode(regs))
117+
goto bad_page_fault;
116118
return;
119+
}
117120

118121
if (unlikely(fault & VM_FAULT_ERROR)) {
119122
if (fault & VM_FAULT_OOM)

0 commit comments

Comments
 (0)