All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kees Cook <keescook@chromium.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Nilay Vaish <nilayvaish@gmail.com>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Ingo Molnar <mingo@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Brian Gerst <brgerst@gmail.com>,
	Byungchul Park <byungchul.park@lge.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 3/6] x86/dumpstack: make printk_stack_address() more generally useful
Date: Thu, 25 Aug 2016 21:40:12 -0700	[thread overview]
Message-ID: <CA+55aFw4hfHMNn_vPGwKjUafV42C+H5ba4S29iJvk225etZ1pg@mail.gmail.com> (raw)
In-Reply-To: <20160826031904.ldqgc6bg4g6is4un@treble>

On Thu, Aug 25, 2016 at 8:19 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> For an oops, there are other opportunities for address leakage besides
> the stack trace function addresses.  There's the raw stack dump which
> dumps the first 12 stack entries.  And there's the register dump.  I'm
> pretty sure we don't want to get rid of those.

We actually probably *do* want to get rid of the stack dump. It's
likely not really useful any more, and more legacy noise.

The register contents we definitely don't want to remove, obviously.
But apart from EIP itself (and LR etc on other architectures), those
actually rather seldom contain code addresses, so that kind of data is
rather harder to misuse.

That said, if you can trigger an oops, you do quite likely have a
security problem already.

So oopses aren't necessarily the first thing to worry about. I'd worry
more about things like WARN_ON_ONCE() that are much more likely things
that might be triggerable (ie we do occasionally have things like
warning for legacy system calls that shouldn't be used any more)

> I suppose we could come up with some innovative way to filter or
> sanitize kernel addresses from the stack dump and the registers.  But
> that probably hurts usability for kernel developers.

Yeah, but see above: an oops really does tend to often be a security
issue on its own, especially if it can be triggered arbitrarily by an
attacker.

> Another issue is that there are a lot of duplicate symbol names in the
> kernel.  So the symbol name alone might not be enough to disambiguate
> the function address.

That is true. It's seldom a big issue, though. Nobody actually uses
the address for anything _anyway_, so people end up disambiguating
those things based on context regardless.

Again, something like addr2line could be an exception, but (a) that
thing is useless in most situations due to randomization and (b) if
you don't randomize then the whole discussion is moot.

Plus add2line could just show all options, and then you end up doing
human disambiguation anyway.

> Not to mention the fact that today there are a gazillion uses of
> printk() with '%p' in the kernel.

Yes. And some of them have been stupiud security issues on their own,
and have nothing to do with symbol names. See for example commit
31b0b385f69d ("nf_conntrack: avoid kernel pointer value leak in slab
name")

> So yes, dmesg_restrict sounds useful to me.  It's a way to prevent users
> from seeing kernel addresses without affecting my ability to debug
> issues.  For a locked down system, why would non-root users need to
> access dmesg anyway?

That's the point. It is only useful for locked-down systems.

But that also means that IT IS NOT USEFUL AS A SECURITY ARGUMENT -
since it's simply not relevant to most systems out there.

Most systems aren't locked down.

> How exactly does removing data from the stack dump make it more useful?

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.

So in order for data to be useful, it has to be more than "data". It
has to be "information". More random useless hex noise is not good.

                   Linus

  reply	other threads:[~2016-08-26  4:40 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 16:50 [PATCH 0/6] x86/dumpstack: more stack dump improvements Josh Poimboeuf
2016-08-24 16:50 ` [PATCH 1/6] perf/x86: check perf_callchain_store() error Josh Poimboeuf
2016-09-08  9:48   ` [tip:x86/asm] perf/x86: Check " tip-bot for Josh Poimboeuf
2016-08-24 16:50 ` [PATCH 2/6] oprofile/x86: add regs->ip to oprofile trace Josh Poimboeuf
2016-08-30 11:30   ` Robert Richter
2016-09-08  9:48   ` [tip:x86/asm] oprofile/x86: Add " tip-bot for Josh Poimboeuf
2016-08-24 16:50 ` [PATCH 3/6] x86/dumpstack: make printk_stack_address() more generally useful Josh Poimboeuf
2016-08-24 17:28   ` Joe Perches
2016-08-24 18:43     ` Josh Poimboeuf
2016-08-24 19:07       ` Joe Perches
2016-08-24 19:24         ` Josh Poimboeuf
2016-08-24 19:57           ` Joe Perches
2016-08-24 18:03   ` Linus Torvalds
2016-08-24 18:22     ` Peter Zijlstra
2016-08-24 18:37       ` Linus Torvalds
2016-08-24 19:37         ` Josh Poimboeuf
2016-08-25 17:49           ` Josh Poimboeuf
2016-08-25 20:41             ` Kees Cook
2016-08-25 21:07               ` Josh Poimboeuf
     [not found]                 ` <CA+55aFy3sgA4=ZPhiDWiRMvWj9QPhUd0JBdUr1hm_6G0aSC6uw@mail.gmail.com>
2016-08-26  2:19                   ` Kees Cook
2016-08-26  3:19                   ` Josh Poimboeuf
2016-08-26  4:40                     ` Linus Torvalds [this message]
2016-08-26  5:56                       ` Josh Poimboeuf
     [not found]                         ` <CA+55aFy8FPRiEr-4p++TGj+keTNsg781q1E1FQZ7z4+nAs0ZaQ@mail.gmail.com>
2016-08-26 13:30                           ` Josh Poimboeuf
2016-08-31 16:53         ` Josh Poimboeuf
2016-08-31 17:15           ` Linus Torvalds
2016-09-01 13:09             ` Josh Poimboeuf
2016-09-01 16:30               ` Linus Torvalds
2016-09-08  9:49   ` [tip:x86/asm] x86/dumpstack: Make " tip-bot for Josh Poimboeuf
2016-08-24 16:50 ` [PATCH 4/6] x86/dumpstack: add get_stack_pointer() and get_frame_pointer() Josh Poimboeuf
2016-09-08  9:49   ` [tip:x86/asm] x86/dumpstack: Add " tip-bot for Josh Poimboeuf
2016-08-24 16:50 ` [PATCH 5/6] x86/dumpstack: remove unnecessary stack pointer arguments Josh Poimboeuf
2016-09-08  9:50   ` [tip:x86/asm] x86/dumpstack: Remove " tip-bot for Josh Poimboeuf
2016-08-24 16:50 ` [PATCH 6/6] x86/dumpstack: allow preemption in show_stack_log_lvl() and dump_trace() Josh Poimboeuf
2016-09-08  7:04   ` Ingo Molnar
2016-09-08 21:47     ` Josh Poimboeuf
2016-09-08 21:49       ` [PATCH v2] " Josh Poimboeuf
2016-09-13 18:29         ` Ingo Molnar
2016-09-13 19:38           ` Josh Poimboeuf
2016-09-14 17:39         ` [tip:x86/asm] x86/dumpstack: Allow " tip-bot for Josh Poimboeuf
2016-09-09  6:11       ` [PATCH 6/6] x86/dumpstack: allow " Ingo Molnar
2016-09-01 13:13 ` [PATCH 0/6] x86/dumpstack: more stack dump improvements 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=CA+55aFw4hfHMNn_vPGwKjUafV42C+H5ba4S29iJvk225etZ1pg@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=brgerst@gmail.com \
    --cc=byungchul.park@lge.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=nilayvaish@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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.