[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YjlYeYpou9wdkcZS@google.com>
Date: Tue, 22 Mar 2022 14:02:49 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Maninder Singh <maninder1.s@...sung.com>
Cc: mcgrof@...nel.org, pmladek@...e.com, rostedt@...dmis.org,
senozhatsky@...omium.org, andriy.shevchenko@...ux.intel.com,
linux@...musvillemoes.dk, akpm@...ux-foundation.org,
wangkefeng.wang@...wei.com, v.narang@...sung.com,
swboyd@...omium.org, ojeda@...nel.org,
linux-kernel@...r.kernel.org, linux-modules@...r.kernel.org,
avimalin@...il.com, atomlin@...hat.com, keescook@...omium.org,
ndesaulniers@...gle.com, rdunlap@...radead.org, void@...ifault.com
Subject: Re: [PATCH 1/1 module-next] kallsyms: enhance %pS/s/b printing when
KALLSYSMS is disabled
On (22/03/16 10:05), Maninder Singh wrote:
[..]
> +static int sprint_module_info(char *buf, unsigned long value,
> + int modbuildid, int backtrace, int symbol)
> +{
> + struct module *mod;
> + unsigned long offset;
> + void *base;
> + char *modname;
> + int len;
> + const unsigned char *buildid = NULL;
> + bool add_offset;
> +
> + if (is_ksym_addr(value))
> + return 0;
> +
> + if (backtrace || symbol)
> + add_offset = true;
> + else
> + add_offset = false;
> +
> + preempt_disable();
> + mod = __module_address(value);
> + if (mod) {
> + modname = mod->name;
> +#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
> + if (modbuildid)
> + buildid = mod->build_id;
> +#endif
> + if (add_offset) {
> + base = mod->core_layout.base;
> + offset = value - (unsigned long)base;
> + }
What if address is in module init? Shouldn't this be something like
if (within_module_init(value, mod))
offset = value - (unsigned long)mod->init_layout.base;
else
offset = value - (unsigned long)mod->core_layout.base;
Powered by blists - more mailing lists