|
Message-ID: <20170518141203.GB23654@kroah.com> Date: Thu, 18 May 2017 16:12:03 +0200 From: Greg KH <gregkh@...uxfoundation.org> To: Petr Mladek <pmladek@...e.com> Cc: kernel-hardening@...ts.openwall.com, Sergey Senozhatsky <sergey.senozhatsky@...il.com>, linux-kernel@...r.kernel.org, Catalin Marinas <catalin.marinas@....com>, Will Deacon <will.deacon@....com>, Steven Rostedt <rostedt@...dmis.org>, William Roberts <william.c.roberts@...el.com>, Chris Fries <cfries@...gle.com>, Dave Weinstein <olorin@...gle.com> Subject: Re: [RFC 1/6] lib: vsprintf: additional kernel pointer filtering options On Tue, May 16, 2017 at 01:58:11PM +0200, Petr Mladek wrote: > On Fri 2017-05-05 21:06:56, Greg KH wrote: > > From: Dave Weinstein <olorin@...gle.com> > > > > Add the kptr_restrict setting of 3 which results in both > > %p and %pK values being replaced by zeros. > > > > Add an additional %pP value inspired by the Grsecurity > > option which explicitly whitelists pointers for output. > > > > This patch is based on work by William Roberts > > <william.c.roberts@...el.com> > > > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > > index e3bf4e0f10b5..f4e11dade1ab 100644 > > --- a/lib/vsprintf.c > > +++ b/lib/vsprintf.c > > @@ -395,6 +395,16 @@ struct printf_spec { > > #define FIELD_WIDTH_MAX ((1 << 23) - 1) > > #define PRECISION_MAX ((1 << 15) - 1) > > > > +int kptr_restrict __read_mostly; > > + > > +/* > > + * Always cleanse %p and %pK specifiers > > + */ > > +static inline int kptr_restrict_always_cleanse_pointers(void) > > The name of the function is very long and still confusing. > It uses the word "always" but there are many types of pointers > that are not cleared with this condition, for example %pP, %pa. > > Do we need this helper function at all? It is used > a weird way, see below. Thanks for the comments, I'll revise this for the next version, thanks so much for the review, much appreciated. thanks, greg k-h
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.