The patch titled Subject: buildid: stash away kernels build ID on init has been added to the -mm tree. Its filename is buildid-stash-away-kernels-build-id-on-init.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/buildid-stash-away-kernels-build-id-on-init.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/buildid-stash-away-kernels-build-id-on-init.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Stephen Boyd <swboyd@xxxxxxxxxxxx> Subject: buildid: stash away kernels build ID on init Parse the kernel's build ID at initialization so that other code can print a hex format string representation of the running kernel's build ID. This will be used in the kdump and dump_stack code so that developers can easily locate the vmlinux debug symbols for a crash/stacktrace. Link: https://lkml.kernel.org/r/20210511003845.2429846-4-swboyd@xxxxxxxxxxxx Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx> Acked-by: Baoquan He <bhe@xxxxxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: Alexei Starovoitov <ast@xxxxxxxxxx> Cc: Jessica Yu <jeyu@xxxxxxxxxx> Cc: Evan Green <evgreen@xxxxxxxxxxxx> Cc: Hsin-Yi Wang <hsinyi@xxxxxxxxxxxx> Cc: Dave Young <dyoung@xxxxxxxxxx> Cc: Vivek Goyal <vgoyal@xxxxxxxxxx> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/buildid.h | 3 +++ init/main.c | 1 + lib/buildid.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) --- a/include/linux/buildid.h~buildid-stash-away-kernels-build-id-on-init +++ a/include/linux/buildid.h @@ -10,4 +10,7 @@ int build_id_parse(struct vm_area_struct __u32 *size); int build_id_parse_buf(const void *buf, unsigned char *build_id, u32 buf_size); +extern unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX]; +void init_vmlinux_build_id(void); + #endif --- a/init/main.c~buildid-stash-away-kernels-build-id-on-init +++ a/init/main.c @@ -880,6 +880,7 @@ asmlinkage __visible void __init __no_sa set_task_stack_end_magic(&init_task); smp_setup_processor_id(); debug_objects_early_init(); + init_vmlinux_build_id(); cgroup_init_early(); --- a/lib/buildid.c~buildid-stash-away-kernels-build-id-on-init +++ a/lib/buildid.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include <linux/buildid.h> +#include <linux/cache.h> #include <linux/elf.h> #include <linux/kernel.h> #include <linux/pagemap.h> @@ -172,3 +173,17 @@ int build_id_parse_buf(const void *buf, { return parse_build_id_buf(build_id, NULL, buf, buf_size); } + +unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX] __ro_after_init; + +/** + * init_vmlinux_build_id - Compute and stash the running kernel's build ID + */ +void __init init_vmlinux_build_id(void) +{ + extern const void __start_notes __weak; + extern const void __stop_notes __weak; + unsigned int size = &__stop_notes - &__start_notes; + + build_id_parse_buf(&__start_notes, vmlinux_build_id, size); +} _ Patches currently in -mm which might be from swboyd@xxxxxxxxxxxx are buildid-only-consider-gnu-notes-for-build-id-parsing.patch buildid-add-api-to-parse-build-id-out-of-buffer.patch buildid-stash-away-kernels-build-id-on-init.patch dump_stack-add-vmlinux-build-id-to-stack-traces.patch module-add-printk-formats-to-add-module-build-id-to-stacktraces.patch arm64-stacktrace-use-%psb-for-backtrace-printing.patch x86-dumpstack-use-%psb-%pbb-for-backtrace-printing.patch scripts-decode_stacktracesh-support-debuginfod.patch scripts-decode_stacktracesh-silence-stderr-messages-from-addr2line-nm.patch scripts-decode_stacktracesh-indicate-auto-can-be-used-for-base-path.patch buildid-mark-some-arguments-const.patch buildid-fix-kernel-doc-notation.patch kdump-use-vmlinux_build_id-to-simplify.patch