* [PATCH] binder: Use %p for pointer formatting
@ 2026-09-18 10:30 Sebastian Andrzej Siewior
2026-09-24 22:17 ` Carlos Llamas
0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-18 10:30 UTC (permalink / raw)
To: linux-kernel
Cc: Arve Hjønnevåg, Alice Ryhl, Carlos Llamas,
Christian Brauner, Greg Kroah-Hartman, Todd Kjos,
Tiffany Y. Yang
Commit 8ca86f1639ec5 ("binder: replace "%p" with "%pK"") introduced the
%pK modifier in order not to leak kernel pointer.
Since commit ad67b74d2469d ("printk: hash addresses printed with %p")
pointers are hashed by default and the behaviour can be controller by
`hash_pointers' boot argument.
Commit 57483a362741e ("binder: Create safe versions of binder log
files") introduced a hashed version while preserving the other interface
where pointers are returned. This interface is for debugging of memory
leaks. Ideally it would provide just one interface without leaking
pointers.
The policy on %p is to not introduce new ones. Rather then removing the
pointer output make it use %p.
Cc: Tiffany Y. Yang <ynaffit@google.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/android/binder.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 8f2ef1bd539f1..0a42d2957772d 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -6413,7 +6413,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
spin_lock(&t->lock);
to_proc = t->to_proc;
seq_printf(m,
- "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %ld a%d r%d elapsed %lldms",
+ "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld a%d r%d elapsed %lldms",
prefix, t->debug_id, t,
t->from_pid,
t->from_tid,
@@ -6578,7 +6578,7 @@ static void print_binder_ref_olocked(struct seq_file *m,
struct binder_ref *ref)
{
binder_node_lock(ref->node);
- seq_printf(m, " ref %d: desc %d %snode %d s %d w %d d %pK\n",
+ seq_printf(m, " ref %d: desc %d %snode %d s %d w %d d %p\n",
ref->data.debug_id, ref->data.desc,
ref->node->proc ? "" : "dead ",
ref->node->debug_id, ref->data.strong,
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] binder: Use %p for pointer formatting
2026-09-18 10:30 [PATCH] binder: Use %p for pointer formatting Sebastian Andrzej Siewior
@ 2026-09-24 22:17 ` Carlos Llamas
2026-09-25 7:59 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 5+ messages in thread
From: Carlos Llamas @ 2026-09-24 22:17 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-kernel, Arve Hjønnevåg, Alice Ryhl,
Christian Brauner, Greg Kroah-Hartman, Todd Kjos,
Tiffany Y. Yang
On Fri, Sep 18, 2026 at 12:30:08PM +0200, Sebastian Andrzej Siewior wrote:
> Commit 8ca86f1639ec5 ("binder: replace "%p" with "%pK"") introduced the
> %pK modifier in order not to leak kernel pointer.
> Since commit ad67b74d2469d ("printk: hash addresses printed with %p")
> pointers are hashed by default and the behaviour can be controller by
> `hash_pointers' boot argument.
> Commit 57483a362741e ("binder: Create safe versions of binder log
> files") introduced a hashed version while preserving the other interface
> where pointers are returned. This interface is for debugging of memory
> leaks. Ideally it would provide just one interface without leaking
> pointers.
These binder_log files is a different thing. These are userspace
pointers.
>
> The policy on %p is to not introduce new ones. Rather then removing the
> pointer output make it use %p.
IIUC, the policy is to use %pK for seq_printf() files exposed to users.
This is the relevant section from printk-formats.rst:
| If (and only if) you are printing addresses as a content of a virtual file in
| e.g. procfs or sysfs (using e.g. seq_printf(), not printk()) read by a
| userspace process, use the %pK modifier described below instead of %p or %px.
Has this changed?
>
> Cc: Tiffany Y. Yang <ynaffit@google.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/android/binder.c | 4 ++--
This file is now deleted anyway.
Cheers,
--
Carlos Llamas
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] binder: Use %p for pointer formatting
2026-09-24 22:17 ` Carlos Llamas
@ 2026-09-25 7:59 ` Sebastian Andrzej Siewior
2026-09-25 12:01 ` Carlos Llamas
0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-25 7:59 UTC (permalink / raw)
To: Carlos Llamas
Cc: linux-kernel, Arve Hjønnevåg, Alice Ryhl,
Christian Brauner, Greg Kroah-Hartman, Todd Kjos,
Tiffany Y. Yang
On 2026-09-24 22:17:06 [+0000], Carlos Llamas wrote:
> On Fri, Sep 18, 2026 at 12:30:08PM +0200, Sebastian Andrzej Siewior wrote:
> > Commit 8ca86f1639ec5 ("binder: replace "%p" with "%pK"") introduced the
> > %pK modifier in order not to leak kernel pointer.
> > Since commit ad67b74d2469d ("printk: hash addresses printed with %p")
> > pointers are hashed by default and the behaviour can be controller by
> > `hash_pointers' boot argument.
> > Commit 57483a362741e ("binder: Create safe versions of binder log
> > files") introduced a hashed version while preserving the other interface
> > where pointers are returned. This interface is for debugging of memory
> > leaks. Ideally it would provide just one interface without leaking
> > pointers.
>
> These binder_log files is a different thing. These are userspace
> pointers.
It looks like the reveal points, I wasn't aware that those are userspace
pointers.
> > The policy on %p is to not introduce new ones. Rather then removing the
> > pointer output make it use %p.
>
> IIUC, the policy is to use %pK for seq_printf() files exposed to users.
> This is the relevant section from printk-formats.rst:
>
> | If (and only if) you are printing addresses as a content of a virtual file in
> | e.g. procfs or sysfs (using e.g. seq_printf(), not printk()) read by a
> | userspace process, use the %pK modifier described below instead of %p or %px.
>
> Has this changed?
I am working on getting rid of %pK.
> >
> > Cc: Tiffany Y. Yang <ynaffit@google.com>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> > drivers/android/binder.c | 4 ++--
>
> This file is now deleted anyway.
And with it the %pK usage?
>
> Cheers,
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] binder: Use %p for pointer formatting
2026-09-25 7:59 ` Sebastian Andrzej Siewior
@ 2026-09-25 12:01 ` Carlos Llamas
2026-09-25 12:08 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 5+ messages in thread
From: Carlos Llamas @ 2026-09-25 12:01 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-kernel, Arve Hjønnevåg, Alice Ryhl,
Christian Brauner, Greg Kroah-Hartman, Todd Kjos,
Tiffany Y. Yang
On Fri, Sep 25, 2026 at 09:59:01AM +0200, Sebastian Andrzej Siewior wrote:
> On 2026-09-24 22:17:06 [+0000], Carlos Llamas wrote:
> > On Fri, Sep 18, 2026 at 12:30:08PM +0200, Sebastian Andrzej Siewior wrote:
> > > Commit 8ca86f1639ec5 ("binder: replace "%p" with "%pK"") introduced the
> > > %pK modifier in order not to leak kernel pointer.
> > > Since commit ad67b74d2469d ("printk: hash addresses printed with %p")
> > > pointers are hashed by default and the behaviour can be controller by
> > > `hash_pointers' boot argument.
> > > Commit 57483a362741e ("binder: Create safe versions of binder log
> > > files") introduced a hashed version while preserving the other interface
> > > where pointers are returned. This interface is for debugging of memory
> > > leaks. Ideally it would provide just one interface without leaking
> > > pointers.
> >
> > These binder_log files is a different thing. These are userspace
> > pointers.
>
> It looks like the reveal points, I wasn't aware that those are userspace
> pointers.
>
> > > The policy on %p is to not introduce new ones. Rather then removing the
> > > pointer output make it use %p.
> >
> > IIUC, the policy is to use %pK for seq_printf() files exposed to users.
> > This is the relevant section from printk-formats.rst:
> >
> > | If (and only if) you are printing addresses as a content of a virtual file in
> > | e.g. procfs or sysfs (using e.g. seq_printf(), not printk()) read by a
> > | userspace process, use the %pK modifier described below instead of %p or %px.
> >
> > Has this changed?
>
> I am working on getting rid of %pK.
Oh, I see. That makes sense. Nice!
>
> > >
> > > Cc: Tiffany Y. Yang <ynaffit@google.com>
> > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > > ---
> > > drivers/android/binder.c | 4 ++--
> >
> > This file is now deleted anyway.
>
> And with it the %pK usage?
Yeah, it's all gone now:
https://git.kernel.org/gregkh/char-misc/c/fd2bc059ed46
--
Carlos Llamas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-25 12:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 10:30 [PATCH] binder: Use %p for pointer formatting Sebastian Andrzej Siewior
2026-09-24 22:17 ` Carlos Llamas
2026-09-25 7:59 ` Sebastian Andrzej Siewior
2026-09-25 12:01 ` Carlos Llamas
2026-09-25 12:08 ` Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®