Re: [PATCH][RESEND] lib/vsprintf: make-printk-non-secret printks all addresses as unhashed

From: Timur Tabi
Date: Fri Feb 05 2021 - 13:29:13 EST




On 2/5/21 4:59 AM, Vlastimil Babka wrote:
Thanks a lot. Should this also affect %pK though? IIUC, there's currently no way
to achieve non-mangled %pK in all cases, even with the most permissive
kptr_restrict=1 setting:
- in IRQ, there's "pK-error" instead
- in a context of non-CAP_SYSLOG process, nulls are printed

Hmmm.. I thought %pK prints an unhashed pointer when the user is root, at least in situations where the user can be known (e.g. during an ioctl call).

Yes, neither should matter if %pK were only used for prints that generate
content of some kind of /proc file read by a CAP_SYSLOG process, but that
doesn't seem to be the case and there are %pK used for printing to dmesg too...

I thought about that. On one hand, people who use %pK probably really wanted a hashed pointer printed. On the other hand, I agree that %pK should not be used for dmesg prints.

I get the feeling that some (most?) people who use %pK don't really understand how it's supposed to be used.

I can extend make-printk-non-secret to %pK if everyone agrees.