|
Date: Wed, 18 Oct 2017 16:59:36 -0700 From: Joe Perches <joe@...ches.com> To: "Tobin C. Harding" <me@...in.cc>, Kees Cook <keescook@...omium.org> Cc: "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, "Jason A. Donenfeld" <Jason@...c4.com>, Theodore Ts'o <tytso@....edu>, Linus Torvalds <torvalds@...ux-foundation.org>, Paolo Bonzini <pbonzini@...hat.com>, Tycho Andersen <tycho@...ker.com>, "Roberts, William C" <william.c.roberts@...el.com>, Tejun Heo <tj@...nel.org>, Jordan Glover <Golden_Miller83@...tonmail.ch>, Greg KH <gregkh@...uxfoundation.org>, Petr Mladek <pmladek@...e.com>, Ian Campbell <ijc@...lion.org.uk>, Sergey Senozhatsky <sergey.senozhatsky@...il.com>, Catalin Marinas <catalin.marinas@....com>, Will Deacon <wilal.deacon@....com>, Steven Rostedt <rostedt@...dmis.org>, Chris Fries <cfries@...gle.com>, Dave Weinstein <olorin@...gle.com>, Daniel Micay <danielmicay@...il.com>, Djalal Harouni <tixxdz@...il.com> Subject: Re: [PATCH v5] printk: hash addresses printed with %p 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@...in.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ยข
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.