[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 5 Apr 2018 08:10:14 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"Tobin C . Harding" <me@...in.cc>, Joe Perches <joe@...ches.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.cz>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH v4 2/9] vsprintf: Consistent %pK handling for
kptr_restrict == 0
On (04/04/18 10:58), Petr Mladek wrote:
>
> restricted_pointer() pretends that it prints the address when kptr_restrict
> is set to zero. But it is never called in this situation. Instead,
> pointer() falls back to ptr_to_id() and hashes the pointer.
>
> This patch removes the potential confusion. klp_restrict is checked only
> in restricted_pointer().
>
> It should actually fix a small race when the address might get printed
> unhashed:
Early morning, didn't have my coffee yet [like really didn't].
But I don't see how you "fix" a race. "echo 0" might still be called
later than switch().
[..]
> @@ -1426,8 +1427,8 @@ char *restricted_pointer(char *buf, char *end, const void *ptr,
>
> switch (kptr_restrict) {
> case 0:
> - /* Always print %pK values */
> - break;
> + /* Handle as %p, hash and do _not_ leak addresses. */
> + return ptr_to_id(buf, end, ptr, spec);
>From "Always print pK values" to "Always print hashed values"... Do we need
%pK then? You probably need to update printk-formats.rst as well.
-ss
Powered by blists - more mailing lists