Closed zyxiaooo closed 1 year ago
The crash utility tries to get the offset of uts_namespace.name
from vmlinux and use it if available:
MEMBER_OFFSET_INIT(uts_namespace_name, "uts_namespace", "name"); <<--- get
...
else if (symbol_exists("init_uts_ns")) {
long offset = sizeof(int);
if (VALID_MEMBER(uts_namespace_name))
offset = OFFSET(uts_namespace_name);
readmem(symbol_value("init_uts_ns") + offset, <<--- use
KVADDR, &kt->utsname, sizeof(struct new_utsname),
"init_uts_ns", RETURN_ON_ERROR);
So if you use the correct vmlinux, it will not fail.
btw, the offset of uts_namespace.name
looks to be 0 in 5.15 kernel source.
$ git show v5.15:include/linux/utsname.h
...
struct uts_namespace {
struct new_utsname name;
struct user_namespace *user_ns;
struct ucounts *ucounts;
struct ns_common ns;
} __randomize_layout;
Why is your kenel's one 24? If you use the randomize layout facility, the "randomized" vmlinux will be required by crash. But I've not used the facility and not sure if crash can handle randomized one.
Thanks for the quick reply! Seems that I do have CONFIG_GCC_PLUGIN_RANDSTRUCT=y. How can I get the randomized vmlinux? I am a bit surprise that the binary+debuginfo generated by gcc doesn't reveal the randomized info.
I found an old thread about this: https://listman.redhat.com/archives/crash-utility/2018-January/thread.html#7316
and it looks still not fixed for gcc... but maybe clang can solve it. https://lore.kernel.org/lkml/E226151B-FBAD-4FA2-B226-96231783D732@kernel.org/
ok, seems that is the issue, after turning off the plugin it worked fine. Thanks for the help, anyway it seems not an issue with crash util but gcc/plugin, will close this.
I am trying to walk through crash util with 5.15 core dump and hit an error. The error complains about core version and binary mismatch, but digging further, seems that it is crash/gdb failed to parse metadata because some offset is wrong e.g. init_uts_ns when parsing core version info. Following change will fix the issue, the offset below is 0, expected to be 24:
The offset info is already in VMCORE_INFO and crash debug message prints it correctly:
I am wondering if this case is generally not supported yet or something else is going on.