powerpc: Restore KUAP registers on syscall restart exit

During a syscall restart, block KUAP so that pending interrupts can be
replayed. The original KUAP state is not restored before returning to
userspace, causing subsequent userspace accesses to fault and eventually
trigger bad_access_pkey(), crashing the kernel.

The original KUAP register values are already saved in
arch_enter_from_user_mode(). Restore them on the syscall restart exit
path before returning to userspace.

Fixes: bee25f97ad ("powerpc: Enable GENERIC_ENTRY feature")
Reported-by: Sayali Patil <sayalip@linux.ibm.com>
Closes: https://lore.kernel.org/linuxppc-dev/fcd11556-27ac-4cd7-8c77-50716dec6985@linux.ibm.com/
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
Tested-by: Sayali Patil <sayalip@linux.ibm.com>
[Maddy: Added Closes tag]
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260615162617.2861795-1-mkchauras@gmail.com
This commit is contained in:
Mukesh Kumar Chaurasiya (IBM)
2026-06-15 21:56:17 +05:30
committed by Madhavan Srinivasan
parent 5c86f1c1f9
commit 4e1187e12d

View File

@@ -166,6 +166,7 @@ notrace unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *reg
goto again;
}
kuap_user_restore(regs);
regs->exit_result |= regs->exit_flags;
return regs->exit_result;