LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Tobin C. Harding" <me@tobin.cc>
To: Kees Cook <keescook@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Anna-Maria Gleixner <anna-maria@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Theodore Ts'o <tytso@mit.edu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v2 4/4] vsprintf: Add command line option debug_early_boot
Date: Thu, 3 May 2018 15:09:02 +1000	[thread overview]
Message-ID: <20180503050902.GM3791@eros> (raw)
In-Reply-To: <CAGXu5jKQbyBAD733Xyy94yMa0rQ=yRV4smXr+YHbeBGMxdChgQ@mail.gmail.com>

On Wed, May 02, 2018 at 09:57:57PM -0700, Kees Cook wrote:
> On Wed, May 2, 2018 at 3:50 PM, Tobin C. Harding <me@tobin.cc> wrote:
> > Currently printing [hashed] pointers requires either a hw RNG or enough
> > entropy to be available.  Early in the boot sequence these conditions
> > may not be met resulting in a dummy string '(____ptrval____)' being
> > printed.  This makes debugging the early boot sequence difficult.  We
> > can relax the requirement to use cryptographically secure hashing during
> > debugging.  This enables debugging while keeping development/production
> > kernel behaviour the same.
> >
> > If new command line option debug_early_boot is enabled use
> > cryptographically insecure hashing and hash pointer value immediately.
> >
> > Signed-off-by: Tobin C. Harding <me@tobin.cc>
> > ---
> >  Documentation/admin-guide/kernel-parameters.txt |  8 ++++++++
> >  lib/vsprintf.c                                  | 18 ++++++++++++++++++
> >  2 files changed, 26 insertions(+)
> >
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> > index b8d1379aa039..ab619c4ccbf2 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > @@ -748,6 +748,14 @@
> >
> >         debug           [KNL] Enable kernel debugging (events log level).
> >
> > +       debug_early_boot
> > +                       [KNL] Enable debugging early in the boot sequence.  If
> > +                       enabled, we use a weak hash instead of siphash to hash
> > +                       pointers.  Use this option if you need to see pointer
> > +                       values during early boot (i.e you are seeing instances
> > +                       of '(___ptrval___)') - cryptographically insecure,
> > +                       please do not use on production kernels.
> > +
> >         debug_locks_verbose=
> >                         [KNL] verbose self-tests
> >                         Format=<0|1>
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > index 3697a19c2b25..6c139b442267 100644
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -1654,6 +1654,18 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
> >         return widen_string(buf, buf - buf_start, end, spec);
> >  }
> >
> > +/* Make pointers available for printing early in the boot sequence. */
> > +static int debug_early_boot;
> 
> Please make this __ro_after_init too.

Good suggestion.  I forgot, we are supposed to be closing security
wholes not opening them :)

thanks,
Tobin.

      reply	other threads:[~2018-05-03  5:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 22:50 [PATCH v2 0/4] enable early printing of hashed pointers Tobin C. Harding
2018-05-02 22:50 ` [PATCH v2 1/4] random: Fix whitespace pre random-bytes work Tobin C. Harding
2018-05-02 22:50 ` [PATCH v2 2/4] random: Return nbytes filled from hw RNG Tobin C. Harding
2018-05-02 22:50 ` [PATCH v2 3/4] vsprintf: Use hw RNG for ptr_key Tobin C. Harding
2018-05-02 22:50 ` [PATCH v2 4/4] vsprintf: Add command line option debug_early_boot Tobin C. Harding
2018-05-03  4:57   ` Kees Cook
2018-05-03  5:09     ` 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=20180503050902.GM3791@eros \
    --to=me@tobin.cc \
    --cc=akpm@linux-foundation.org \
    --cc=anna-maria@linutronix.de \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --subject='Re: [PATCH v2 4/4] vsprintf: Add command line option debug_early_boot' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).