All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc: Use %p for pointer formatting
@ 2026-09-18 10:50 Sebastian Andrzej Siewior
  2026-09-18 20:05 ` Andrew Morton
  2026-09-19  0:39 ` SJ Park
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-18 10:50 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Uladzislau Rezki

Commit 45ec16908e84e ("mm: use %pK for /proc/vmallocinfo") introduced
the %pK in order not to leak kernel pointers.
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.
The policy on %p is to not introduce new ones.
Removing %pK makes it possible to remove its handling from the library.

Looking at the output, having the pointer in the output makes it
possible to distinguish the individual entries.

Use %p instead %pK.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 mm/vmalloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index bea9f76ed7e74..6461336f899bc 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -5308,7 +5308,7 @@ static void show_purge_info(struct seq_file *m)
 	for_each_vmap_node(vn) {
 		spin_lock(&vn->lazy.lock);
 		list_for_each_entry(va, &vn->lazy.head, list) {
-			seq_printf(m, "0x%pK-0x%pK %7ld unpurged vm_area\n",
+			seq_printf(m, "0x%p-0x%p %7ld unpurged vm_area\n",
 				(void *)va->va_start, (void *)va->va_end,
 				va_size(va));
 		}
@@ -5331,7 +5331,7 @@ static int vmalloc_info_show(struct seq_file *m, void *p)
 		list_for_each_entry(va, &vn->busy.head, list) {
 			if (!va->vm) {
 				if (va->flags & VMAP_RAM)
-					seq_printf(m, "0x%pK-0x%pK %7ld vm_map_ram\n",
+					seq_printf(m, "0x%p-0x%p %7ld vm_map_ram\n",
 						(void *)va->va_start, (void *)va->va_end,
 						va_size(va));
 
@@ -5345,7 +5345,7 @@ static int vmalloc_info_show(struct seq_file *m, void *p)
 			/* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
 			smp_rmb();
 
-			seq_printf(m, "0x%pK-0x%pK %7ld",
+			seq_printf(m, "0x%p-0x%p %7ld",
 				v->addr, v->addr + v->size, v->size);
 
 			if (v->caller)
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/vmalloc: Use %p for pointer formatting
  2026-09-18 10:50 [PATCH] mm/vmalloc: Use %p for pointer formatting Sebastian Andrzej Siewior
@ 2026-09-18 20:05 ` Andrew Morton
  2026-09-18 20:14   ` Sebastian Andrzej Siewior
  2026-09-19  0:39 ` SJ Park
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2026-09-18 20:05 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-mm, Uladzislau Rezki

On Fri, 18 Sep 2026 12:50:13 +0200 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> Commit 45ec16908e84e ("mm: use %pK for /proc/vmallocinfo") introduced
> the %pK in order not to leak kernel pointers.
> 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.
> The policy on %p is to not introduce new ones.
> Removing %pK makes it possible to remove its handling from the library.
> 
> Looking at the output, having the pointer in the output makes it
> possible to distinguish the individual entries.
> 
> Use %p instead %pK.

Fair enough.

I added this (important) info to the changelog.  Please confirm its
accurary.

: /proc/vmallocinfo has mode 0400, so this change doesn't make kernel
: pointer information available to unprivileged userspace.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/vmalloc: Use %p for pointer formatting
  2026-09-18 20:05 ` Andrew Morton
@ 2026-09-18 20:14   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-18 20:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Uladzislau Rezki

On 2026-09-18 13:05:41 [-0700], Andrew Morton wrote:
> On Fri, 18 Sep 2026 12:50:13 +0200 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> 
> > Commit 45ec16908e84e ("mm: use %pK for /proc/vmallocinfo") introduced
> > the %pK in order not to leak kernel pointers.
> > 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.
> > The policy on %p is to not introduce new ones.
> > Removing %pK makes it possible to remove its handling from the library.
> > 
> > Looking at the output, having the pointer in the output makes it
> > possible to distinguish the individual entries.
> > 
> > Use %p instead %pK.
> 
> Fair enough.
> 
> I added this (important) info to the changelog.  Please confirm its
> accurary.
> 
> : /proc/vmallocinfo has mode 0400, so this change doesn't make kernel
> : pointer information available to unprivileged userspace.

Confirmed.
[%p is hashed by default so things shouldn't change here.]

Sebastian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/vmalloc: Use %p for pointer formatting
  2026-09-18 10:50 [PATCH] mm/vmalloc: Use %p for pointer formatting Sebastian Andrzej Siewior
  2026-09-18 20:05 ` Andrew Morton
@ 2026-09-19  0:39 ` SJ Park
  2026-09-19  7:23   ` Uladzislau Rezki
  1 sibling, 1 reply; 5+ messages in thread
From: SJ Park @ 2026-09-19  0:39 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: SJ Park, linux-mm, Andrew Morton, Uladzislau Rezki

On Fri, 18 Sep 2026 12:50:13 +0200 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> Commit 45ec16908e84e ("mm: use %pK for /proc/vmallocinfo") introduced
> the %pK in order not to leak kernel pointers.
> Since commit ad67b74d2469d ("printk: hash addresses printed with
> %p") pointers are hashed by default and the behaviour can be controller

s/controller/controlled/ ?

> by `hash_pointers' boot argument.
> The policy on %p is to not introduce new ones.
> Removing %pK makes it possible to remove its handling from the library.
> 
> Looking at the output, having the pointer in the output makes it
> possible to distinguish the individual entries.
> 
> Use %p instead %pK.

Makes sense to me.

> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Reviewed-by: SJ Park <sj@kernel.org>


Thanks,
SJ

[...]


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/vmalloc: Use %p for pointer formatting
  2026-09-19  0:39 ` SJ Park
@ 2026-09-19  7:23   ` Uladzislau Rezki
  0 siblings, 0 replies; 5+ messages in thread
From: Uladzislau Rezki @ 2026-09-19  7:23 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Sebastian Andrzej Siewior, linux-mm, Andrew Morton,
	Uladzislau Rezki

On Fri, Sep 18, 2026 at 05:39:33PM -0700, SJ Park wrote:
> On Fri, 18 Sep 2026 12:50:13 +0200 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> 
> > Commit 45ec16908e84e ("mm: use %pK for /proc/vmallocinfo") introduced
> > the %pK in order not to leak kernel pointers.
> > Since commit ad67b74d2469d ("printk: hash addresses printed with
> > %p") pointers are hashed by default and the behaviour can be controller
> 
> s/controller/controlled/ ?
> 
> > by `hash_pointers' boot argument.
> > The policy on %p is to not introduce new ones.
> > Removing %pK makes it possible to remove its handling from the library.
> > 
> > Looking at the output, having the pointer in the output makes it
> > possible to distinguish the individual entries.
> > 
> > Use %p instead %pK.
> 
> Makes sense to me.
> 
> > 
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> 
> Reviewed-by: SJ Park <sj@kernel.org>
> 
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>

--
Uladzislau Rezki


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-19  7:23 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:50 [PATCH] mm/vmalloc: Use %p for pointer formatting Sebastian Andrzej Siewior
2026-09-18 20:05 ` Andrew Morton
2026-09-18 20:14   ` Sebastian Andrzej Siewior
2026-09-19  0:39 ` SJ Park
2026-09-19  7:23   ` Uladzislau Rezki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.