Skip to content

Commit c124f40

Browse files
hcahcagregkh
authored andcommitted
s390/ptrace: Fix pointer dereferencing in regs_get_kernel_stack_nth()
commit 7f8073c upstream. 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 <will@kernel.org> 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: stable@vger.kernel.org Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2d3b0ba commit c124f40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/s390/kernel/ptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,5 +1574,5 @@ unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
15741574
addr = kernel_stack_pointer(regs) + n * sizeof(long);
15751575
if (!regs_within_kernel_stack(regs, addr))
15761576
return 0;
1577-
return READ_ONCE_NOCHECK(addr);
1577+
return READ_ONCE_NOCHECK(*(unsigned long *)addr);
15781578
}

0 commit comments

Comments
 (0)