[PATCH -next] arm64/ptrace: Fix stack-out-of-bounds read in regs_get_kernel_stack_nth()

Heiko Carstens hca at linux.ibm.com
Fri Jun 13 08:04:35 PDT 2025


On Thu, Jun 12, 2025 at 05:33:32PM +0100, Will Deacon wrote:
> On Wed, Jun 04, 2025 at 12:55:33AM +0000, Tengda Wu wrote:
> > diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
> > index f79b0d5f71ac..fe3f7e554d14 100644
> > --- a/arch/arm64/kernel/ptrace.c
> > +++ b/arch/arm64/kernel/ptrace.c
> > @@ -141,7 +141,7 @@ unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
> >  
> >  	addr += n;
> >  	if (regs_within_kernel_stack(regs, (unsigned long)addr))
> > -		return *addr;
> > +		return READ_ONCE_NOCHECK(addr);
> 
> I think this should be '*addr', but that makes me wonder wtf s390 is
> doing...

That's obviously a brown paper bag bug in our code... will be fixed.



More information about the linux-arm-kernel mailing list