* [PATCH V2] powerpc: Restore KUAP registers on syscall restart exit
@ 2026-06-15 16:26 Mukesh Kumar Chaurasiya (IBM)
2026-06-16 6:44 ` Sayali Patil
0 siblings, 1 reply; 2+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-06-15 16:26 UTC (permalink / raw)
To: maddy, mpe, npiggin, chleroy, sshegde, ruanjinjie, mkchauras,
linuxppc-dev, linux-kernel
Cc: Sayali Patil
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: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
Reported-by: Sayali Patil <sayalip@linux.ibm.com>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
---
V1 -> V2:
- Commit message rephrased
V1: https://lore.kernel.org/all/20260613123831.1510474-1-mkchauras@gmail.com
arch/powerpc/kernel/interrupt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 89a999be1352..f04978080837 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -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;
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH V2] powerpc: Restore KUAP registers on syscall restart exit
2026-06-15 16:26 [PATCH V2] powerpc: Restore KUAP registers on syscall restart exit Mukesh Kumar Chaurasiya (IBM)
@ 2026-06-16 6:44 ` Sayali Patil
0 siblings, 0 replies; 2+ messages in thread
From: Sayali Patil @ 2026-06-16 6:44 UTC (permalink / raw)
To: Mukesh Kumar Chaurasiya (IBM), maddy, mpe, npiggin, chleroy,
sshegde, ruanjinjie, linuxppc-dev, linux-kernel
On 15/06/26 21:56, Mukesh Kumar Chaurasiya (IBM) wrote:
> 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: bee25f97ad24 ("powerpc: Enable GENERIC_ENTRY feature")
> Reported-by: Sayali Patil <sayalip@linux.ibm.com>
> Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
> ---
> V1 -> V2:
> - Commit message rephrased
> V1: https://lore.kernel.org/all/20260613123831.1510474-1-mkchauras@gmail.com
>
> arch/powerpc/kernel/interrupt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index 89a999be1352..f04978080837 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -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;
This fixes the reported issue.
Tested-by: Sayali Patil <sayalip@linux.ibm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-16 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 16:26 [PATCH V2] powerpc: Restore KUAP registers on syscall restart exit Mukesh Kumar Chaurasiya (IBM)
2026-06-16 6:44 ` Sayali Patil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox