From: Maninder Singh <maninder1.s@samsung.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: "mcgrof@kernel.org" <mcgrof@kernel.org>,
"pmladek@suse.com" <pmladek@suse.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"andriy.shevchenko@linux.intel.com"
<andriy.shevchenko@linux.intel.com>,
"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
Vaneet Narang <v.narang@samsung.com>,
"swboyd@chromium.org" <swboyd@chromium.org>,
"ojeda@kernel.org" <ojeda@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
"avimalin@gmail.com" <avimalin@gmail.com>,
"atomlin@redhat.com" <atomlin@redhat.com>,
"keescook@chromium.org" <keescook@chromium.org>,
"ndesaulniers@google.com" <ndesaulniers@google.com>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
"void@manifault.com" <void@manifault.com>
Subject: RE: [PATCH 1/1 module-next] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled
Date: Tue, 22 Mar 2022 11:52:19 +0530 [thread overview]
Message-ID: <20220322062219epcms5p1bc1cc758470ebf175aa4eee20b7837ae@epcms5p1> (raw)
In-Reply-To: <CGME20220316043552epcas5p29b0723b7c55a3bcc9b4d858660e45933@epcms5p1>
Hi Sergey,
> > + 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;
Yes, this can be done, but I think then we need to handle it with some more info.
In module allocation first we load core_layout and then init_layout w.r.t address range
as below (ARM64):
ffff800000eb0000 -> core_layout
ffff800000eb4000 -> init_layout
So if we write only offset(w.r.t core_layout), then user can get a hint if it going beyond normal text
then it means it is init text.
But if we take offset from init and core separately, and we only print the offset (not function name),
we need to write alongwith offset that it is init or core area.
Otherwise user will get confused which offset it is, whether to check init or core text area.
And also while printing modules, kernel also uses core_layout as base address only:
static int m_show(struct seq_file *m, void *p)
{
..
/* Used by oprofile and other similar tools. */
value = m->private ? NULL : mod->core_layout.base;
seq_printf(m, " 0x%px", value);
..
}
and also normal %ps prints like below:
ps 0xffff800000eb4004
load address of module is 0xffff800000eb0000
so normal offset is 4004 for init text section.
and same thing is printed with current patch:
pS 0xffff800000eb0000+0x4004 [crash]
Still if we need to handle separately, then please suggest only offset is ok or we need to
add string for init or core also like below:
init_text start + offset
pS 0xffff800000eb4000+0x4 [crash init_text]
And also then there will be discrepancy for rodata or other sections, which offset to take.
If we are taking it from core_layout then init section can also be taken with same.
As of now it is unique offset calculation for all sections.
Thanks,
Maninder Singh
next parent reply other threads:[~2022-03-22 6:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220316043552epcas5p29b0723b7c55a3bcc9b4d858660e45933@epcms5p1>
2022-03-22 6:22 ` Maninder Singh [this message]
[not found] <CGME20220316043552epcas5p29b0723b7c55a3bcc9b4d858660e45933@epcas5p2.samsung.com>
2022-03-16 4:35 ` Maninder Singh
2022-03-17 10:59 ` Petr Mladek
2022-03-22 5:02 ` Sergey Senozhatsky
2022-03-22 17:31 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220322062219epcms5p1bc1cc758470ebf175aa4eee20b7837ae@epcms5p1 \
--to=maninder1.s@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=atomlin@redhat.com \
--cc=avimalin@gmail.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mcgrof@kernel.org \
--cc=ndesaulniers@google.com \
--cc=ojeda@kernel.org \
--cc=pmladek@suse.com \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=swboyd@chromium.org \
--cc=v.narang@samsung.com \
--cc=void@manifault.com \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®