RE: [RFC] vsprintf: compile error on %09pK
From: Jaewon Kim
Date: Tue Apr 04 2023 - 08:33:54 EST
>On Tue 2023-04-04 19:12:01, Jaewon Kim wrote:
>> >From: Jaewon Kim
>> >> Sent: 03 April 2023 15:40
>> >...
>> >> I wanted to print phys_addr_t type value only when kptr_restrict sysctl is
>> >> allowed. So I thought I could use %pK for that purpose. And the physical
>> >> address is not that long. I wanted to make that length short like 9 hex.
>> >
>> >Isn't that is the wrong format for physical addresses anyway?
>> >They can be larger than virtual ones (eg x86 with PAE).
>>
>> Yeah, correct. I just used %pK to hide physical address, I thought it could be
>> leak in security perspective. Could you give me advice how I can hide the
>> address by default and look the address if kptr_restrict allow it?
>
>Could you please send a patch that would show what value you want to print?
>
>The initial mail mentioned converting %09lx to %09pK in some driver.
>Then it included a warning when compiling from mm/page_alloc.o
>
O
Oh I just found something I'm interested. I was printing rmem->base and
rmem->name and wanted to hide the rmem->base. The commit aeb9267eb6b1
("of: reserved-mem: print out reserved-mem details during boot - v6.3-rc1")
just used %pa. If %pa is not good enough in security perspecitve, I think
I can use %pa.
Yes it was just my curiosity. I don't actually need the length.
I'm OK now.
Thank you
>Honestly, I think that you could just use %pK or %p. IMHO, it does not
>make sense to optimize it for the length.
>
>Anyway, there is still the question if the address is really worth
>printing. Will it really help to locate a potential problem?
>
>Best Regards,
>Petr