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

Reply via email to