[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YG8I2dQWkOIkypqO@gunter>
Date: Thu, 8 Apr 2021 15:44:57 +0200
From: Jessica Yu <jeyu@...nel.org>
To: Stephen Boyd <swboyd@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Evan Green <evgreen@...omium.org>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-doc@...r.kernel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3 04/12] module: Add printk format to add module build
ID to stacktraces
+++ Stephen Boyd [30/03/21 20:05 -0700]:
[snipped]
>diff --git a/kernel/module.c b/kernel/module.c
>index 30479355ab85..6f5bc1b046a5 100644
>--- a/kernel/module.c
>+++ b/kernel/module.c
>@@ -13,6 +13,7 @@
> #include <linux/trace_events.h>
> #include <linux/init.h>
> #include <linux/kallsyms.h>
>+#include <linux/buildid.h>
> #include <linux/file.h>
> #include <linux/fs.h>
> #include <linux/sysfs.h>
>@@ -2770,6 +2771,20 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
> }
> mod->core_kallsyms.num_symtab = ndst;
> }
>+
>+static void init_build_id(struct module *mod, const struct load_info *info)
>+{
>+ const Elf_Shdr *sechdr;
>+ unsigned int i;
>+
>+ for (i = 0; i < info->hdr->e_shnum; i++) {
>+ sechdr = &info->sechdrs[i];
>+ if (!sect_empty(sechdr) && sechdr->sh_type == SHT_NOTE &&
>+ !build_id_parse_buf((void *)sechdr->sh_addr, mod->build_id,
>+ sechdr->sh_size))
>+ break;
>+ }
>+}
Why not just look for the .note.gnu.build-id section instead of trying
to parse each note section? Doesn't it always contain the build id? At
least the ld man page seems to suggest this section name should be
consistent.
Jessica
Powered by blists - more mailing lists