public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Tobin C. Harding" <me@tobin.cc>
To: Kees Cook <keescook@chromium.org>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Tycho Andersen" <tycho@tycho.ws>,
	"Roberts, William C" <william.c.roberts@intel.com>,
	"Tejun Heo" <tj@kernel.org>,
	"Jordan Glover" <Golden_Miller83@protonmail.ch>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Petr Mladek" <pmladek@suse.com>, "Joe Perches" <joe@perches.com>,
	"Ian Campbell" <ijc@hellion.org.uk>,
	"Sergey Senozhatsky" <sergey.senozhatsky@gmail.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <wilal.deacon@arm.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Chris Fries" <cfries@google.com>,
	"Dave Weinstein" <olorin@google.com>,
	"Daniel Micay" <danielmicay@gmail.com>,
	"Djalal Harouni" <tixxdz@gmail.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>,
	kernel-hardening@lists.openwall.com
Subject: Re: [PATCH 0/5] add printk specifier %px, unique identifier
Date: Tue, 28 Nov 2017 12:43:43 +1100	[thread overview]
Message-ID: <20171128014343.GR17858@eros> (raw)
In-Reply-To: <CAGXu5jJfppOKj6pD7-ETSqqPOL1hBDQ31ZXj1damJmC4qTqvvw@mail.gmail.com>

On Mon, Nov 27, 2017 at 04:57:18PM -0800, Kees Cook wrote:
> On Mon, Nov 27, 2017 at 3:40 PM, Tobin C. Harding <me@tobin.cc> wrote:
> > Linus,
> >
> > I know you are bored of this patch set already and this pits your vast
> > experience against my eight months kernel dev experience ;)
> >
> > I humbly maintain that hashing %p and suggesting people use %x
> > _correctly_ isn't a WIN solution.
> >
> > Please don't go easy on me because I'm new, if I'm out of line - say
> > so.
> >
> > This set is based on the following assumptions.
> >
> > 1. We now have leaking_addresses.pl illuminating leaking addresses.
> > 2. We have no _clear_ strategy for fixing leaks once found.
> > 3. We do not have a proposed non opt-in solution.
> > 4. There is a distinct use case for this specifier.
> >
> > Patch 1: Corrects the docs for %pK.
> >
> > Patch 2: Refactors %pK code out of pointer() into helper function.
> >
> > Patch 3: Adds specifier %px, small 'x' was chosen because the hashed hex
> >          value is printed in lower case.
> >
> > Patch 4/5: Provides example usage of new specifier.
> >
> > The hashing code is based on the work done hashing %p during 4.14 dev
> > cycle.
> >
> > Finally, with this patch set in place, we have the added benefit that
> > newbies (me) can quietly go around the kernel 'sweeping up' after
> > leaking addresses. This as apposed to using a hammer and hashing all
> > %p. And if this is deemed too little and too slow we can always search
> > and replace '%p' with '%px'.
> 
> How does this opt-in to %px help? We'll still have %p everywhere. :(
> Why not invert this? %p is hashed and %px is the old %p? Then we can
> move %x users to %px.

This is a really nice twist, I don't know why it hasn't come up
before. For the record it

- Plugs a bunch of potential current leaks.
- Is on by default (*not* opt-in).
- Is easy to use (%p if you don't care, %px if you _really_ want the address).
- Reduces risk of future developers creating grep hell by using %x

(- makes Linus happy because it does everything he has suggested except
promote use of %x)

> I'd still like to see a default-on solution for this class of leaks...

I'll re-spin this tomorrow and see if we can't stop bothering everyone
with it :)

thanks,
Tobin.

      reply	other threads:[~2017-11-28  1:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 23:40 [PATCH 0/5] add printk specifier %px, unique identifier Tobin C. Harding
2017-11-27 23:40 ` [PATCH 1/5] docs: correct documentation for %pK Tobin C. Harding
2017-11-28  0:46   ` Kees Cook
2017-11-27 23:40 ` [PATCH 2/5] vsprintf: refactor pK code out of pointer() Tobin C. Harding
2017-11-27 23:40 ` [PATCH 3/5] vsprintf: add specifier %px, unique identifier Tobin C. Harding
2017-11-27 23:40 ` [PATCH 4/5] KVM: use %px to print token identifier Tobin C. Harding
2017-11-27 23:40 ` [PATCH 5/5] vfio_pci: " Tobin C. Harding
2017-11-28  0:03 ` [PATCH 0/5] add printk specifier %px, unique identifier Linus Torvalds
2017-11-28  1:09   ` Linus Torvalds
2017-11-28  6:26     ` Eric W. Biederman
2017-11-28 10:12       ` David Laight
2017-11-28 17:33       ` Linus Torvalds
2017-11-28 17:41         ` Joe Perches
2017-11-28 18:04           ` Linus Torvalds
2017-11-28 18:11             ` Linus Torvalds
2017-11-28 17:44         ` David Laight
2017-11-28  0:57 ` Kees Cook
2017-11-28  1:43   ` Tobin C. Harding [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=20171128014343.GR17858@eros \
    --to=me@tobin.cc \
    --cc=Golden_Miller83@protonmail.ch \
    --cc=Jason@zx2c4.com \
    --cc=catalin.marinas@arm.com \
    --cc=cfries@google.com \
    --cc=danielmicay@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc@hellion.org.uk \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olorin@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rkrcmar@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tixxdz@gmail.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tycho@tycho.ws \
    --cc=tytso@mit.edu \
    --cc=wilal.deacon@arm.com \
    --cc=william.c.roberts@intel.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