Skip to content

Commit 7f8073c

Browse files
hcahcaAlexander Gordeev
authored andcommitted
s390/ptrace: Fix pointer dereferencing in regs_get_kernel_stack_nth()
The recent change which added READ_ONCE_NOCHECK() to read the nth entry from the kernel stack incorrectly dropped dereferencing of the stack pointer in order to read the requested entry. In result the address of the entry is returned instead of its content. Dereference the pointer again to fix this. Reported-by: Will Deacon <[email protected]> Closes: https://lore.kernel.org/r/20250612163331.GA13384@willie-the-truck Fixes: d93a855 ("s390/ptrace: Avoid KASAN false positives in regs_get_kernel_stack_nth()") Cc: [email protected] Reviewed-by: Alexander Gordeev <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 7360ee4 commit 7f8073c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/s390/include/asm/ptrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static __always_inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *r
265265
addr = kernel_stack_pointer(regs) + n * sizeof(long);
266266
if (!regs_within_kernel_stack(regs, addr))
267267
return 0;
268-
return READ_ONCE_NOCHECK(addr);
268+
return READ_ONCE_NOCHECK(*(unsigned long *)addr);
269269
}
270270

271271
/**

0 commit comments

Comments
 (0)