[Crash-utility] [PATCH] arm64: exclude mapping symbols in modules
AKASHI Takahiro
takahiro.akashi at linaro.org
Thu Oct 6 03:10:46 UTC 2016
Dave,
One question.
On Tue, Oct 04, 2016 at 11:00:16AM -0400, Dave Anderson wrote:
>
>
> ----- Original Message -----
> > If some module has been inserted, crash util complains about
> > module symbols:
> > ...
> > please wait... (gathering module symbol data)
> > crash: store_module_symbols_v2: total: 15 mcnt: 16
> > and end up with stopping.
> >
> > This patch excludes mapping symbols, like $d and $x, as arm does.
On arm64, when KASLR is enabled, a function call between a module and
the kernel will be done via a veneer (PLT) if the displacement is more
than +/-128MB. So disassembled code looks a bit useless:
===8<===
crash> mod -S
MODULE NAME SIZE OBJECT FILE
ffff04d78f4b8000 testmod 16384 /opt/buildroot/15.11_64/root/kexec/testmod.ko
crash> bt
PID: 1102 TASK: ffffb4da8e910000 CPU: 0 COMMAND: "insmod"
#0 [ffffb4da8e9afa30] __crash_kexec at ffff0e0045020a54
#1 [ffffb4da8e9afb90] panic at ffff0e004505523c
#2 [ffffb4da8e9afc50] testmod_init at ffff04d78f4b6014 [testmod]
#3 [ffffb4da8e9afb40] do_one_initcall at ffff0e0044f7333c
--- <Exception in user> ---
PC: 0000000a LR: 00000000 SP: ffff04d78f4b6000 PSTATE: 7669726420656c75
X12: ffffb4da8e9ac000 X11: ffff04d78f4b6018 X10: ffffb4da8e9afc50 X9: 20676e6973756143
X8: 00000000 X7: ffff0e0045e5ce00 X6: ffff0e0045e5c000 X5: 600001c5
X4: ffff0e0045020a58 X3: ffffb4da8e9afa30 X2: ffff0e004502098c X1: ffffb4da8e9afa30
X0: 00000124
crash> dis testmod_init
0xffff04d78f4b6000 <init_module>: stp x29, x30, [sp,#-16]!
0xffff04d78f4b6004 <testmod_init+4>: mov x29, sp
0xffff04d78f4b6008 <testmod_init+8>: ldr x0, 0xffff04d78f4b6018
0xffff04d78f4b600c <testmod_init+12>: bl 0xffff04d78f4b6090
0xffff04d78f4b6010 <testmod_init+16>: ldr x0, 0xffff04d78f4b6020
0xffff04d78f4b6014 <testmod_init+20>: bl 0xffff04d78f4b6080
=> branch to a veneer
crash> dis 0xffff04d78f4b6080 4
0xffff04d78f4b6080 <testmod_exit+88>: mov x16, #0xffffffffffff5120 // #-44768
0xffff04d78f4b6084 <testmod_exit+92>: movk x16, #0x4505, lsl #16
0xffff04d78f4b6088 <testmod_exit+96>: movk x16, #0xe00, lsl #32
0xffff04d78f4b608c <testmod_exit+100>: br x16
=> branch to 0xffff0e0045055120
(= panic())
===>8===
Is there any method to resolve such kind of indirect addressing
to a symbolic name at dis command?
(It may be difficult to discriminate PLT from normal branches, though).
Thanks,
-Takahiro AKASHI
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
>
> Queued for crash-7.1.6:
>
> https://github.com/crash-utility/crash/commit/9a5cbfe998060a8f99997b1e463353abcfcf1fce
>
> Thanks,
> Dave
>
>
> > ---
> > symbols.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/symbols.c b/symbols.c
> > index 99c8b8b..a657ead 100644
> > --- a/symbols.c
> > +++ b/symbols.c
> > @@ -2251,10 +2251,11 @@ store_module_kallsyms_v2(struct load_module *lm, int
> > start, int curr,
> > continue;
> >
> > /*
> > - * On ARM we have linker mapping symbols like '$a' and '$d'.
> > + * On ARM/ARM64 we have linker mapping symbols like '$a'
> > + * or '$x' for ARM64, and '$d'.
> > * Make sure that these don't end up into our symbol list.
> > */
> > - if (machine_type("ARM") &&
> > + if ((machine_type("ARM") || machine_type("ARM64")) &&
> > !machdep->verify_symbol(nameptr, ec->st_value, ec->st_info))
> > continue;
> >
> > --
> > 2.10.0
> >
> > --
> > Crash-utility mailing list
> > Crash-utility at redhat.com
> > https://www.redhat.com/mailman/listinfo/crash-utility
> >
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
More information about the Crash-utility
mailing list