All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sasha Levin <alexander.levin@verizon.com>,
	Konstantin Khlebnikov <koct9i@gmail.com>
Subject: Re: [PATCH 2/4] x86/dumpstack: remove kernel text addresses from stack dump
Date: Tue, 29 Nov 2016 01:27:11 +0300	[thread overview]
Message-ID: <20161128222711.GA32239@node.shutemov.name> (raw)
In-Reply-To: <20161128204958.go7a6evhqm3usq7x@treble>

On Mon, Nov 28, 2016 at 02:49:58PM -0600, Josh Poimboeuf wrote:
> On Fri, Nov 25, 2016 at 03:26:04PM +0300, Kirill A. Shutemov wrote:
> > On Tue, Oct 25, 2016 at 09:51:12AM -0500, Josh Poimboeuf wrote:
> > > Printing kernel text addresses in stack dumps is of questionable value,
> > > especially now that address randomization is becoming common.
> > > 
> > > It can be a security issue because it leaks kernel addresses.  It also
> > > affects the usefulness of the stack dump.  Linus says:
> > > 
> > >   "I actually spend time cleaning up commit messages in logs, because
> > >   useless data that isn't actually information (random hex numbers) is
> > >   actively detrimental.
> > > 
> > >   It makes commit logs less legible.
> > > 
> > >   It also makes it harder to parse dumps.
> > > 
> > >   It's not useful. That makes it actively bad.
> > > 
> > >   I probably look at more oops reports than most people. I have not
> > >   found the hex numbers useful for the last five years, because they are
> > >   just randomized crap.
> > > 
> > >   The stack content thing just makes code scroll off the screen etc, for
> > >   example."
> > > 
> > > The only real downside to removing these addresses is that they can be
> > > used to disambiguate duplicate symbol names.  However such cases are
> > > rare, and the context of the stack dump should be enough to be able to
> > > figure it out.
> > > 
> > > There's now a 'faddr2line' script which can be used to convert a
> > > function address to a file name and line:
> > > 
> > >   $ ./scripts/faddr2line ~/k/vmlinux write_sysrq_trigger+0x51/0x60
> > >   write_sysrq_trigger+0x51/0x60:
> > >   write_sysrq_trigger at drivers/tty/sysrq.c:1098
> > > 
> > > Or gdb can be used:
> > > 
> > >   $ echo "list *write_sysrq_trigger+0x51" |gdb ~/k/vmlinux |grep "is in"
> > >   (gdb) 0xffffffff815b5d83 is in driver_probe_device (/home/jpoimboe/git/linux/drivers/base/dd.c:378).
> > > 
> > > (But note that when there are duplicate symbol names, gdb will only show
> > > the first symbol it finds.  faddr2line is recommended over gdb because
> > > it handles duplicates and it also does function size checking.)
> > 
> > The commit breaks scripts/decode_stacktrace.sh.
> > 
> > Not sure if it's possible to fix it only on decode_stacktrace.sh side: we
> > seems don't have a way to clearly distinguish stack trace line of any
> > other.
> 
> How about this bash regex?  Seems to work for me with no false
> positives.
> 
>   [[ $line =~ [^+\ ]+\+0x[0-9a-f]+/0x[0-9a-f]+ ]]

Seems works fine to me. Thanks.

Feel free to use my tested-by.

-- 
 Kirill A. Shutemov

  reply	other threads:[~2016-11-28 22:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 14:51 [PATCH 0/4] x86: fix kernel address printk exposures Josh Poimboeuf
2016-10-25 14:51 ` [PATCH 1/4] scripts/faddr2line: fix "size mismatch" error Josh Poimboeuf
2016-10-26  5:39   ` [tip:x86/asm] scripts/faddr2line: Fix " tip-bot for Josh Poimboeuf
2016-10-25 14:51 ` [PATCH 2/4] x86/dumpstack: remove kernel text addresses from stack dump Josh Poimboeuf
2016-10-26  5:40   ` [tip:x86/asm] x86/dumpstack: Remove " tip-bot for Josh Poimboeuf
2016-11-25 12:26   ` [PATCH 2/4] x86/dumpstack: remove " Kirill A. Shutemov
2016-11-28 20:49     ` Josh Poimboeuf
2016-11-28 22:27       ` Kirill A. Shutemov [this message]
2016-11-28 23:06         ` [PATCH] decode_stacktrace: fix address line detection on x86 Josh Poimboeuf
2016-11-29  7:13           ` [tip:x86/urgent] tools/decode_stacktrace.sh: Fix " tip-bot for Josh Poimboeuf
2016-11-29 13:06             ` Josh Poimboeuf
2016-11-29 13:20               ` Ingo Molnar
2016-11-29 13:24           ` [tip:x86/asm] scripts/decode_stacktrace.sh: " tip-bot for Josh Poimboeuf
2016-10-25 14:51 ` [PATCH 3/4] x86/dumpstack: remove raw stack dump Josh Poimboeuf
2016-10-26  5:40   ` [tip:x86/asm] x86/dumpstack: Remove " tip-bot for Josh Poimboeuf
2016-10-25 14:51 ` [PATCH 4/4] mm: remove kernel address exposure in free_reserved_area() Josh Poimboeuf
2016-10-25 14:51   ` Josh Poimboeuf
2016-10-26  5:41   ` [tip:x86/asm] mm/page_alloc: Remove " tip-bot for Josh Poimboeuf

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=20161128222711.GA32239@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=alexander.levin@verizon.com \
    --cc=jpoimboe@redhat.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.