path: root/arch/xtensa
diff options
authorMax Filippov <>2021-02-07 04:57:58 -0800
committerMax Filippov <>2021-03-29 11:25:11 -0700
commit7b9acbb6aad4f54623dcd4bd4b1a60fe0c727b09 (patch)
tree370431fbaa75e42e1c97d2dec184de46005ddd9b /arch/xtensa
parentab5eb336411f18fd449a1fb37d36a55ec422603f (diff)
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. Cc: Reported-by: Mark Rutland <> Signed-off-by: Max Filippov <>
Diffstat (limited to 'arch/xtensa')
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 7666408ce12a..95a74890c7e9 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -112,8 +112,11 @@ 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))
+ goto bad_page_fault;
+ }
if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)