Re: [PATCH 1/3] lib/test_printf: Clean up test of hashed pointers

From: Uwe Kleine-KÃnig
Date: Thu Feb 27 2020 - 09:31:25 EST


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?

Best regards
Uwe

Attachment: signature.asc
Description: OpenPGP digital signature