[Crash-utility] [PATCH] Fix a potential segfault for the ARM64 "bt -S <stack-address>" command

Dave Anderson anderson at redhat.com
Mon Nov 4 15:39:17 UTC 2019



----- Original Message -----

> > The stackframe.fp(0xffffff9c29e4f8e0) is larger than the stacktop address, so
> > lead to segmentation violation gernarated by accessing regs->sp:
> > (gdb) p /x 18446743644915693792//stkptr
> > $5 = 0xffffff9c29e4f8e0
> > (gdb) p /x 0xffffff9c29e4f8e0-0xffffff800c428000//STACK_OFFSET_TYPE(stkptr)
> > $6 = 0x1c1da278e0
> > (gdb) p /x regs
> > $7 = 0x55717394b3c0
> > (gdb) p *(struct arm64_pt_regs *) 0x55717394b3c0
> > Cannot access memory at address 0x55717394b3c0
> > 
> > For fix this, I think it must be add a condition "arm64_in_exception_text(stackframe.pc) && INSTACK(stackframe.fp, bt)"
> > to avoid an invalid exception frame before transitioning to the process stack.

Or alternatively, would it be better to have arm64_is_kernel_exception_frame()
verify that the "regs" assignment is legitimate, and if not, just return FALSE?

Dave




More information about the Crash-utility mailing list