From: Mark Rutland <mark.rutland@arm.com>
To: Haesung Kim <matia.kim@lge.com>
Cc: jirislaby@kernel.org, akpm@linux-foundation.org,
mingo@kernel.org, geert@linux-m68k.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] stacktrace: print real address of trace entries
Date: Fri, 4 Sep 2020 17:07:36 +0100 [thread overview]
Message-ID: <20200904160736.GB21956@C02TD0UTHF1T.local> (raw)
In-Reply-To: <1599213624-14632-1-git-send-email-matia.kim@lge.com>
On Fri, Sep 04, 2020 at 07:00:24PM +0900, Haesung Kim wrote:
> If function is marked as static and compiler decies to lnline function
> with or without inline keyword, the function has no symbol.
> We just know symbol located near the address of the inline function
> by %pS type that shows symbol and offset. But we don't know function
> name.
What exactly is output in this case today? Can't you get the real
addr/symbol from scripts/faddr2line?
> The real address let us extract the function name and location of
> source code by debugging tools such as addr2line. This is helpful to
> debug.
Not logging the address was a deliberate decision to minimize leakage of
the kernel's VA layout. This undermines that, and I don't think doing so
is a good idea.
If there is a problem with faddr2line we should work out how to improve
that.
Mark.
>
> Signed-off-by: Haesung Kim <matia.kim@lge.com>
> ---
> kernel/stacktrace.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
> index 946f44a..b7168c5 100644
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -24,12 +24,15 @@ void stack_trace_print(const unsigned long *entries, unsigned int nr_entries,
> int spaces)
> {
> unsigned int i;
> + unsigned long ip;
>
> if (WARN_ON(!entries))
> return;
>
> for (i = 0; i < nr_entries; i++)
> - printk("%*c%pS\n", 1 + spaces, ' ', (void *)entries[i]);
> + ip = entries[i];
> + printk("%*c[<%px>] %pS\n",
> + 1 + spaces, ' ', (void *) ip, (void *) ip);
> }
> EXPORT_SYMBOL_GPL(stack_trace_print);
>
> @@ -47,13 +50,15 @@ int stack_trace_snprint(char *buf, size_t size, const unsigned long *entries,
> unsigned int nr_entries, int spaces)
> {
> unsigned int generated, i, total = 0;
> + unsigned long ip;
>
> if (WARN_ON(!entries))
> return 0;
>
> for (i = 0; i < nr_entries && size; i++) {
> - generated = snprintf(buf, size, "%*c%pS\n", 1 + spaces, ' ',
> - (void *)entries[i]);
> + ip = entries[i];
> + generated = snprintf(buf, size, "%*c[<%px>] %pS\n",
> + 1 + spaces, ' ', (void *) ip, (void *) ip);
>
> total += generated;
> if (generated >= size) {
> --
> 2.7.4
>
prev parent reply other threads:[~2020-09-04 16:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 10:00 Haesung Kim
2020-09-04 16:07 ` Mark Rutland [this message]
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=20200904160736.GB21956@C02TD0UTHF1T.local \
--to=mark.rutland@arm.com \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matia.kim@lge.com \
--cc=mingo@kernel.org \
/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®