* [PATCH] tracing/user_events: Don't use %pK through printk
@ 2025-02-17 13:16 Thomas Weißschuh
2025-02-19 0:10 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Weißschuh @ 2025-02-17 13:16 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers
Cc: linux-kernel, linux-trace-kernel, Thomas Weißschuh
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@linutronix.de/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
kernel/trace/trace_events_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 97325fbd62836f4fb477c4a2b2936eff544291ec..3effc6fce20e65a8077de5221eb69db04fb1a775 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -455,7 +455,7 @@ static void user_event_enabler_fault_fixup(struct work_struct *work)
if (ret && ret != -ENOENT) {
struct user_event *user = enabler->event;
- pr_warn("user_events: Fault for mm: 0x%pK @ 0x%llx event: %s\n",
+ pr_warn("user_events: Fault for mm: 0x%p @ 0x%llx event: %s\n",
mm->mm, (unsigned long long)uaddr, EVENT_NAME(user));
}
---
base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
change-id: 20250217-restricted-pointers-trace-a0fb12707ac6
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing/user_events: Don't use %pK through printk
2025-02-17 13:16 [PATCH] tracing/user_events: Don't use %pK through printk Thomas Weißschuh
@ 2025-02-19 0:10 ` Masami Hiramatsu
2025-02-19 7:14 ` Thomas Weißschuh
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2025-02-19 0:10 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Steven Rostedt, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Mon, 17 Feb 2025 14:16:12 +0100
Thomas Weißschuh <thomas.weissschuh@linutronix.de> 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@linutronix.de/
This is only for the kernel pointer, but the "uaddr" below means it
has a user space address. So I think this does not need to be applied.
Thank you,
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> kernel/trace/trace_events_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index 97325fbd62836f4fb477c4a2b2936eff544291ec..3effc6fce20e65a8077de5221eb69db04fb1a775 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -455,7 +455,7 @@ static void user_event_enabler_fault_fixup(struct work_struct *work)
> if (ret && ret != -ENOENT) {
> struct user_event *user = enabler->event;
>
> - pr_warn("user_events: Fault for mm: 0x%pK @ 0x%llx event: %s\n",
> + pr_warn("user_events: Fault for mm: 0x%p @ 0x%llx event: %s\n",
> mm->mm, (unsigned long long)uaddr, EVENT_NAME(user));
> }
>
>
> ---
> base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
> change-id: 20250217-restricted-pointers-trace-a0fb12707ac6
>
> Best regards,
> --
> Thomas Weißschuh <thomas.weissschuh@linutronix.de>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing/user_events: Don't use %pK through printk
2025-02-19 0:10 ` Masami Hiramatsu
@ 2025-02-19 7:14 ` Thomas Weißschuh
2025-02-19 8:36 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Weißschuh @ 2025-02-19 7:14 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Steven Rostedt, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Wed, Feb 19, 2025 at 09:10:23AM +0900, Masami Hiramatsu wrote:
> On Mon, 17 Feb 2025 14:16:12 +0100
> Thomas Weißschuh <thomas.weissschuh@linutronix.de> 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@linutronix.de/
>
> This is only for the kernel pointer, but the "uaddr" below means it
> has a user space address. So I think this does not need to be applied.
"uaddr" is formatted with %llx, which is fine.
"%pK" is used for mm->mm, which is a kernel pointer.
> Thank you,
>
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > ---
> > kernel/trace/trace_events_user.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> > index 97325fbd62836f4fb477c4a2b2936eff544291ec..3effc6fce20e65a8077de5221eb69db04fb1a775 100644
> > --- a/kernel/trace/trace_events_user.c
> > +++ b/kernel/trace/trace_events_user.c
> > @@ -455,7 +455,7 @@ static void user_event_enabler_fault_fixup(struct work_struct *work)
> > if (ret && ret != -ENOENT) {
> > struct user_event *user = enabler->event;
> >
> > - pr_warn("user_events: Fault for mm: 0x%pK @ 0x%llx event: %s\n",
> > + pr_warn("user_events: Fault for mm: 0x%p @ 0x%llx event: %s\n",
> > mm->mm, (unsigned long long)uaddr, EVENT_NAME(user));
> > }
> >
> >
> > ---
> > base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
> > change-id: 20250217-restricted-pointers-trace-a0fb12707ac6
> >
> > Best regards,
> > --
> > Thomas Weißschuh <thomas.weissschuh@linutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing/user_events: Don't use %pK through printk
2025-02-19 7:14 ` Thomas Weißschuh
@ 2025-02-19 8:36 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2025-02-19 8:36 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Steven Rostedt, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Wed, 19 Feb 2025 08:14:34 +0100
Thomas Weißschuh <thomas.weissschuh@linutronix.de> wrote:
> On Wed, Feb 19, 2025 at 09:10:23AM +0900, Masami Hiramatsu wrote:
> > On Mon, 17 Feb 2025 14:16:12 +0100
> > Thomas Weißschuh <thomas.weissschuh@linutronix.de> 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@linutronix.de/
> >
> > This is only for the kernel pointer, but the "uaddr" below means it
> > has a user space address. So I think this does not need to be applied.
>
> "uaddr" is formatted with %llx, which is fine.
> "%pK" is used for mm->mm, which is a kernel pointer.
Oops, I misread it. OK. looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you,
>
> > Thank you,
> >
> > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > > ---
> > > kernel/trace/trace_events_user.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> > > index 97325fbd62836f4fb477c4a2b2936eff544291ec..3effc6fce20e65a8077de5221eb69db04fb1a775 100644
> > > --- a/kernel/trace/trace_events_user.c
> > > +++ b/kernel/trace/trace_events_user.c
> > > @@ -455,7 +455,7 @@ static void user_event_enabler_fault_fixup(struct work_struct *work)
> > > if (ret && ret != -ENOENT) {
> > > struct user_event *user = enabler->event;
> > >
> > > - pr_warn("user_events: Fault for mm: 0x%pK @ 0x%llx event: %s\n",
> > > + pr_warn("user_events: Fault for mm: 0x%p @ 0x%llx event: %s\n",
> > > mm->mm, (unsigned long long)uaddr, EVENT_NAME(user));
> > > }
> > >
> > >
> > > ---
> > > base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
> > > change-id: 20250217-restricted-pointers-trace-a0fb12707ac6
> > >
> > > Best regards,
> > > --
> > > Thomas Weißschuh <thomas.weissschuh@linutronix.de>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-19 8:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 13:16 [PATCH] tracing/user_events: Don't use %pK through printk Thomas Weißschuh
2025-02-19 0:10 ` Masami Hiramatsu
2025-02-19 7:14 ` Thomas Weißschuh
2025-02-19 8:36 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).