[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200302102427.brzxardpanwqlyfy@pathway.suse.cz>
Date: Mon, 2 Mar 2020 11:24:27 +0100
From: Petr Mladek <pmladek@...e.com>
To: Uwe Kleine-König <uwe@...ine-koenig.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-kernel@...r.kernel.org, Ilya Dryomov <idryomov@...il.com>,
Kees Cook <keescook@...omium.org>,
"Tobin C . Harding" <me@...in.cc>
Subject: Re: [PATCH 1/3] lib/test_printf: Clean up test of hashed pointers
On Thu 2020-02-27 15:30:51, Uwe Kleine-König wrote:
> Hello Petr,
>
> On 2/27/20 2:01 PM, Petr Mladek wrote:
> > The commit ad67b74d2469d9b82a ("printk: hash addresses printed with %p")
> > helps to prevent leaking kernel addresses.
> >
> > The testing of this functionality is a bit problematic because the output
> > depends on a random key that is generated during boot. Though, it is
> > still possible to check some aspects:
> >
> > + output string length
> > + hash differs from the original pointer value
> > + top half bits are zeroed on 64-bit systems
>
> Is "hash differs from the original pointer value" a valid check?
> Depending on the random value and the actual pointer I can imagine a
> valid match. Such a match is unlikely but not necessarily bogus, is it?
Yes, there is a small risk or false negative.
It might be possible to try if the problem persist with PTR+1 value or
so. But I am not sure if it is worth it.
The problem is only on 32-bit systems. The chance is really small.
I have added a comment above the check. It can be found via the added
error message.
Note that this check has been there even before in plain_hash().
But it was worse because it was without any comment or error message.
Best Regards,
Petr
Powered by blists - more mailing lists