LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Restore kuap regs during syscall restart exit
@ 2026-06-13 12:38 Mukesh Kumar Chaurasiya (IBM)
  2026-06-15  5:21 ` Shrikanth Hegde
  0 siblings, 1 reply; 3+ messages in thread
From: Mukesh Kumar Chaurasiya (IBM) @ 2026-06-13 12:38 UTC (permalink / raw)
  To: maddy, mpe, npiggin, chleroy, mkchauras, sshegde, ruanjinjie,
	mkchauras, linuxppc-dev, linux-kernel
  Cc: Sayali Patil

During syscall restart, we block the kuap as we need to replay
interrupts. Which are not restored when we exit to the user, hence we
get a fault which ends up with `bad_access_pkey` and hence crashing the
kernel.

We have already stored the kuap values during the entry, just restore
them when we exit.

Applies on linux-next (next-20260610).

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>
---
 arch/powerpc/kernel/interrupt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 89a999be1352..159901d6ba8c 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -165,7 +165,7 @@ notrace unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *reg
 		local_irq_disable();
 		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] 3+ messages in thread

* Re: [PATCH] powerpc: Restore kuap regs during syscall restart exit
  2026-06-13 12:38 [PATCH] powerpc: Restore kuap regs during syscall restart exit Mukesh Kumar Chaurasiya (IBM)
@ 2026-06-15  5:21 ` Shrikanth Hegde
  2026-06-16  5:08   ` Mukesh Kumar Chaurasiya
  0 siblings, 1 reply; 3+ messages in thread
From: Shrikanth Hegde @ 2026-06-15  5:21 UTC (permalink / raw)
  To: Mukesh Kumar Chaurasiya (IBM)
  Cc: Sayali Patil, maddy, mpe, npiggin, chleroy, mkchauras, ruanjinjie,
	linuxppc-dev, linux-kernel

Hi Mukesh.

On 6/13/26 6:08 PM, Mukesh Kumar Chaurasiya (IBM) wrote:
> During syscall restart, we block the kuap as we need to replay
> interrupts. Which are not restored when we exit to the user, hence we
> get a fault which ends up with `bad_access_pkey` and hence crashing the
> kernel.
> 
> We have already stored the kuap values during the entry, just restore
> them when we exit.
> 
> Applies on linux-next (next-20260610).
> 

Please re-write the changelog in imperative mood.
i.e Avoid we/you/I.

https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#describe-your-changes


> 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>
> ---
>   arch/powerpc/kernel/interrupt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index 89a999be1352..159901d6ba8c 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -165,7 +165,7 @@ notrace unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *reg
>   		local_irq_disable();
>   		goto again;
>   	}
> -
> +	kuap_user_restore(regs);

Please describe where was kuap save was done in the stack.

>   	regs->exit_result |= regs->exit_flags;
>   
>   	return regs->exit_result;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc: Restore kuap regs during syscall restart exit
  2026-06-15  5:21 ` Shrikanth Hegde
@ 2026-06-16  5:08   ` Mukesh Kumar Chaurasiya
  0 siblings, 0 replies; 3+ messages in thread
From: Mukesh Kumar Chaurasiya @ 2026-06-16  5:08 UTC (permalink / raw)
  To: Shrikanth Hegde
  Cc: Sayali Patil, maddy, mpe, npiggin, chleroy, mkchauras, ruanjinjie,
	linuxppc-dev, linux-kernel

On Mon, Jun 15, 2026 at 10:51:43AM +0530, Shrikanth Hegde wrote:
> Hi Mukesh.
> 
> On 6/13/26 6:08 PM, Mukesh Kumar Chaurasiya (IBM) wrote:
> > During syscall restart, we block the kuap as we need to replay
> > interrupts. Which are not restored when we exit to the user, hence we
> > get a fault which ends up with `bad_access_pkey` and hence crashing the
> > kernel.
> > 
> > We have already stored the kuap values during the entry, just restore
> > them when we exit.
> > 
> > Applies on linux-next (next-20260610).
> > 
> 
> Please re-write the changelog in imperative mood.
> i.e Avoid we/you/I.
> 
> https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#describe-your-changes
> 
> 
> > 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>
> > ---
> >   arch/powerpc/kernel/interrupt.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> > index 89a999be1352..159901d6ba8c 100644
> > --- a/arch/powerpc/kernel/interrupt.c
> > +++ b/arch/powerpc/kernel/interrupt.c
> > @@ -165,7 +165,7 @@ notrace unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *reg
> >   		local_irq_disable();
> >   		goto again;
> >   	}
> > -
> > +	kuap_user_restore(regs);
> 
> Please describe where was kuap save was done in the stack.
> 
> >   	regs->exit_result |= regs->exit_flags;
> >   	return regs->exit_result;
> 
Sent out V2 with the requested changes.

Regards,
Mukesh


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-16  5:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-13 12:38 [PATCH] powerpc: Restore kuap regs during syscall restart exit Mukesh Kumar Chaurasiya (IBM)
2026-06-15  5:21 ` Shrikanth Hegde
2026-06-16  5:08   ` Mukesh Kumar Chaurasiya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox