From a408c6d27f96e401d6da2b69c5b6f0c31a48a923 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 18 Sep 2026 12:48:52 +0200 Subject: [PATCH] cgroup: Use %p for pointer formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since ad67b74d2469 ("printk: hash addresses printed with %p") %p is hashed by default, which is also what %pK prints under the default kptr_restrict=0. Converting the remaining %pK users makes it possible to remove its handling from vsprintf. Documentation/process/deprecated.rst asks that no new %p uses be added, but these pointers are what makes the css_set debug output useful, and debug.c already prints css pointers with %p. Keep the pointer output and use %p. Under kptr_restrict=1 and 2 the files now show the same hashed values as any other %p output: unprivileged readers see hashes instead of zeros, and a CAP_SYSLOG reader under kptr_restrict=1 no longer gets raw addresses. Booting with hash_pointers=never is the remaining way to see them. Signed-off-by: Sebastian Andrzej Siewior Acked-by: Michal Koutný Signed-off-by: Tejun Heo --- kernel/cgroup/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c index 96004cd65d09..aba243b5fd5f 100644 --- a/kernel/cgroup/debug.c +++ b/kernel/cgroup/debug.c @@ -51,7 +51,7 @@ static int current_css_set_read(struct seq_file *seq, void *v) spin_lock_irq(&css_set_lock); cset = task_css_set(current); refcnt = refcount_read(&cset->refcount); - seq_printf(seq, "css_set %pK %d", cset, refcnt); + seq_printf(seq, "css_set %p %d", cset, refcnt); if (refcnt > cset->nr_tasks) seq_printf(seq, " +%d", refcnt - cset->nr_tasks); seq_puts(seq, "\n"); @@ -125,10 +125,10 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v) * Print out the proc_cset and threaded_cset relationship * and highlight difference between refcount and task_count. */ - seq_printf(seq, "css_set %pK", cset); + seq_printf(seq, "css_set %p", cset); if (rcu_dereference_protected(cset->dom_cset, 1) != cset) { threaded_csets++; - seq_printf(seq, "=>%pK", cset->dom_cset); + seq_printf(seq, "=>%p", cset->dom_cset); } if (!list_empty(&cset->threaded_csets)) { struct css_set *tcset; @@ -137,7 +137,7 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v) list_for_each_entry(tcset, &cset->threaded_csets, threaded_csets_node) { seq_puts(seq, idx ? "," : "<="); - seq_printf(seq, "%pK", tcset); + seq_printf(seq, "%p", tcset); idx++; } } else {