Re: [PATCH 1/2] usb: core: Don't use %pK through printk
From: Thomas Weißschuh
Date: Mon Feb 17 2025 - 09:51:57 EST
On Mon, Feb 17, 2025 at 02:52:05PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Feb 17, 2025 at 02:20:51PM +0100, Thomas Weißschuh wrote:
> > Restricted pointers ("%pK") are not meant to be used through printk().
> > It can unintentionally expose security sensitive, raw pointer values.
> >
> > Use regular pointer formatting instead.
> >
> > Link: https://lore.kernel.org/lkml/20250113171731-dc10e3c1-da64-4af0-b767-7c7070468023@xxxxxxxxxxxxx/
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
>
> So really this is just a revert of 2f964780c03b ("USB: core: replace %p
> with %pK"), right?
In this case, yes.
> Why not express it that way, and explain _why_ it's somehow now ok to
> use %p when previously it wasn't?
The full background is in the email linked from the commit message.
%p is more secure than %pK since
commit ad67b74d2469 ("printk: hash addresses printed with %p").
%pK was never intended to be used through printk() in the first place.
I'm doing the these changes for various subsystems using a common
commit message. The changes are not reverts for all of them and
digging out the specific history for each single line is a bunch
of extra work.
If you want more historical context, I'll resend the series, though.
Thomas