lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2018-04-05 01:10    [W:0.787 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site