Fix for the ARM64 "bt" command's display of the user mode exception

frame at the top of the stack in Linux 4.7 and later kernels.
Without the patch, the contents of the user mode exception frame are
invalid due to the miscalculation of the starting address of the
pt_regs structure on the kernel stack.
(anderson@redhat.com)
This commit is contained in:
Dave Anderson 2017-09-22 14:59:10 -04:00
parent 21687ddf30
commit c975008e61
2 changed files with 8 additions and 1 deletions

View File

@ -608,6 +608,7 @@ arm64_dump_machdep_table(ulong arg)
fprintf(fp, " exp_entry2_start: %lx\n", ms->exp_entry2_start);
fprintf(fp, " exp_entry2_end: %lx\n", ms->exp_entry2_end);
fprintf(fp, " panic_task_regs: %lx\n", (ulong)ms->panic_task_regs);
fprintf(fp, " user_eframe_offset: %ld\n", ms->user_eframe_offset);
fprintf(fp, " PTE_PROT_NONE: %lx\n", ms->PTE_PROT_NONE);
fprintf(fp, " PTE_FILE: ");
if (ms->PTE_FILE)
@ -1376,6 +1377,11 @@ arm64_stackframe_init(void)
MEMBER_OFFSET_INIT(elf_prstatus_pr_pid, "elf_prstatus", "pr_pid");
MEMBER_OFFSET_INIT(elf_prstatus_pr_reg, "elf_prstatus", "pr_reg");
if (MEMBER_EXISTS("pt_regs", "stackframe"))
machdep->machspec->user_eframe_offset = SIZE(pt_regs);
else
machdep->machspec->user_eframe_offset = SIZE(pt_regs) + 16;
machdep->machspec->__exception_text_start =
symbol_value("__exception_text_start");
machdep->machspec->__exception_text_end =
@ -1461,7 +1467,7 @@ arm64_stackframe_init(void)
#define KERNEL_MODE (1)
#define USER_MODE (2)
#define USER_EFRAME_OFFSET (304)
#define USER_EFRAME_OFFSET (machdep->machspec->user_eframe_offset)
/*
* PSR bits

1
defs.h
View File

@ -3110,6 +3110,7 @@ struct machine_specific {
ulong kimage_voffset;
ulong kimage_text;
ulong kimage_end;
ulong user_eframe_offset;
};
struct arm64_stackframe {