Skip to content

Commit 991d384

Browse files
committed
arm64: fix retrieving pt_regs structure on the kernel stack
Currently, bt command in gdb shows broken backtrace as follows: Core was generated by `/init'. #0 0x0000000000000015 in ?? () Then, registers contain broken values as follows: (gdb) info registers x0 0xffffff80080e1d3c -549620671172 ... x26 0xc79ecaf 209317039 x27 0xef412c356afbd300 -1206634617218804992 x28 0x7 7 x29 0xef412c356afbd300 -1206634617218804992 x30 0x16 22 sp 0x124 0x124 pc 0x15 0x15 cpsr 0x40000000 [ EL=0 Z ] fpsr 0x10 16 fpcr 0x0 0 This is because the way retrieving pt_regs structure on the kernel stack is wrong. The subtraction of SIZE(pt_regs) from the address is unnecessary. The cause of this issue is that I added a bug when I merged the commit 19bfb92; the Zhao's original patch was totally correct. Signed-off-by: Hong YANG <hong.yang3@nio.com> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
1 parent c1f1f58 commit 991d384

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libgcore/gcore_arm64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static int gpr_get(struct task_context *target,
2929
BZERO(regs, sizeof(*regs));
3030

3131
readmem(machdep->get_stacktop(target->task) -
32-
machdep->machspec->user_eframe_offset - SIZE(pt_regs), KVADDR,
32+
machdep->machspec->user_eframe_offset, KVADDR,
3333
regs, sizeof(struct user_pt_regs), "gpr_get: user_pt_regs",
3434
gcore_verbose_error_handle());
3535

@@ -126,7 +126,7 @@ static int compat_gpr_get(struct task_context *target,
126126
BZERO(regs, sizeof(*regs));
127127

128128
readmem(machdep->get_stacktop(target->task) -
129-
machdep->machspec->user_eframe_offset - SIZE(pt_regs), KVADDR,
129+
machdep->machspec->user_eframe_offset, KVADDR,
130130
&pt_regs, sizeof(struct pt_regs), "compat_gpr_get: pt_regs",
131131
gcore_verbose_error_handle());
132132

0 commit comments

Comments
 (0)