From: Joe Perches <joe@perches.com>
To: "Tobin C. Harding" <me@tobin.cc>, Kees Cook <keescook@chromium.org>
Cc: "kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Theodore Ts'o <tytso@mit.edu>,
Linus Torvalds <torvalds@linux-foundation.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Tycho Andersen <tycho@docker.com>,
"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>, 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>
Subject: [kernel-hardening] Re: [PATCH v5] printk: hash addresses printed with %p
Date: Wed, 18 Oct 2017 16:59:36 -0700 [thread overview]
Message-ID: <1508371176.6806.29.camel@perches.com> (raw)
In-Reply-To: <20171018234512.GE31318@eros>
On Thu, 2017-10-19 at 10:45 +1100, Tobin C. Harding wrote:
> On Wed, Oct 18, 2017 at 03:31:16PM -0700, Kees Cook wrote:
> > On Wed, Oct 18, 2017 at 2:30 PM, Tobin C. Harding <me@tobin.cc> wrote:
> > > Currently there are many places in the kernel where addresses are being
> > > printed using an unadorned %p. Kernel pointers should be printed using
> > > %pK allowing some control via the kptr_restrict sysctl. Exposing addresses
> > > gives attackers sensitive information about the kernel layout in memory.
> >
> > Is it intended for %pK to be covered by the hash as well? (When a
> > disallowed user is looking at %pK output, like kallsyms, the same hash
> > is seen for all values, rather than just zero -- I assume since the
> > value hashed is zero.)
>
> Good catch, thanks. Have fixed for v6, will wait 24 hours before submitting.
>
> > > + spec.field_width = 2 + 2 * sizeof(unsigned int); /* 0x + hex */
> > > + spec.flags = SPECIAL | SMALL | ZEROPAD;
> >
> > I don't think this should have SPECIAL. We end up changing things like
> > kallsyms (which didn't have 0x before) and printing with double 0x's:
> While on the topic, have you an opinion on whether SMALL is good here. My first thought was that
> capitals _kind_of_ showed that it was an ID not an address, later contemplation made me think this
> may only have meaning to myself from working on the patch so better to leave it SMALL like original.
Perhaps using start/stop indicators could highlight this hashing.
Perhaps output using #hash_ptr#
by adding something like
#define HASHED 128 /* Output hashed ptr with # prefix and postfix */
after #define SPECIAL
but also perhaps adding to the column width would break
hex parsers of seq_ output
> Any thoughts appreciated.
2¢
next prev parent reply other threads:[~2017-10-18 23:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-18 21:30 [kernel-hardening] [PATCH v5] printk: hash addresses printed with %p Tobin C. Harding
2017-10-18 21:30 ` Tobin C. Harding
2017-10-18 22:31 ` [kernel-hardening] " Kees Cook
2017-10-18 22:31 ` Kees Cook
2017-10-18 23:45 ` [kernel-hardening] " Tobin C. Harding
2017-10-18 23:45 ` Tobin C. Harding
2017-10-18 23:59 ` Joe Perches [this message]
2017-10-19 1:03 ` [kernel-hardening] " Jason A. Donenfeld
2017-10-19 1:03 ` Jason A. Donenfeld
2017-10-19 1:31 ` [kernel-hardening] " Sergey Senozhatsky
2017-10-19 1:31 ` Sergey Senozhatsky
2017-10-19 1:36 ` [kernel-hardening] " Jason A. Donenfeld
2017-10-19 1:36 ` Jason A. Donenfeld
2017-10-19 1:44 ` [kernel-hardening] " Tobin C. Harding
2017-10-19 1:44 ` Tobin C. Harding
2017-10-19 5:49 ` [kernel-hardening] " Jason A. Donenfeld
2017-10-19 5:49 ` Jason A. Donenfeld
2017-10-19 17:18 ` [kernel-hardening] " Kees Cook
2017-10-19 17:18 ` Kees Cook
2017-10-19 17:30 ` [kernel-hardening] " Jason A. Donenfeld
2017-10-19 17:30 ` Jason A. Donenfeld
2017-10-19 20:45 ` [PATCH 1/2] random: always call random ready function Jason A. Donenfeld
2017-10-19 20:45 ` [PATCH 2/2] crypto/drbg: account for no longer returning -EALREADY Jason A. Donenfeld
2017-10-21 19:22 ` Stephan Mueller
2017-10-19 20:45 ` [PATCH 1/2] random: always call random ready function Jason A. Donenfeld
2017-10-19 20:58 ` Kees Cook
2017-10-19 21:12 ` Jason A. Donenfeld
2017-10-22 23:32 ` [kernel-hardening] Re: [PATCH v5] printk: hash addresses printed with %p Tobin C. Harding
2017-10-22 23:32 ` Tobin C. Harding
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=1508371176.6806.29.camel@perches.com \
--to=joe@perches.com \
--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=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=me@tobin.cc \
--cc=olorin@google.com \
--cc=pbonzini@redhat.com \
--cc=pmladek@suse.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@docker.com \
--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 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.