From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Kees Cook <kees@kernel.org>, Petr Mladek <pmladek@suse.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Tycho Andersen <tycho@tycho.pizza>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH v2 1/2] vsprintf: Don't leak pointers for %ps without KALLSYMS enabled
Date: Fri, 21 Aug 2026 17:26:13 +0200 [thread overview]
Message-ID: <20260821152614.2202196-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20260821152614.2202196-1-bigeasy@linutronix.de>
The "%ps" format modifier prints the name of the symbol which is more
valuable in terms of debugging and does not leak the actual pointer.
Without KALLSYMS it will leak the pointer which is not intended. The
default policy for pointers is to print a hashed value and not to leak
the actual pointer.
For !KALLSYMS, print "(unknown)" for any symbol resolution. If hashed
pointer are disabled print the bare number.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
lib/vsprintf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2bc6ef483576c..fcb63f22b1997 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1008,7 +1008,9 @@ char *symbol_string(char *buf, char *end, void *ptr,
return string_nocheck(buf, end, sym, spec);
#else
- return special_hex_number(buf, end, value, sizeof(void *));
+ if (unlikely(no_hash_pointers))
+ return special_hex_number(buf, end, value, sizeof(void *));
+ return string_nocheck(buf, end, "(unknown)", spec);
#endif
}
--
2.55.0
next prev parent reply other threads:[~2026-08-21 15:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 15:26 [PATCH v2 0/2] vsprintf: Don't leak pointers Sebastian Andrzej Siewior
2026-08-21 15:26 ` Sebastian Andrzej Siewior [this message]
2026-08-26 15:56 ` [PATCH v2 1/2] vsprintf: Don't leak pointers for %ps without KALLSYMS enabled Petr Mladek
2026-08-27 9:14 ` Sebastian Andrzej Siewior
2026-08-27 9:51 ` Petr Mladek
2026-08-31 13:30 ` Sebastian Andrzej Siewior
2026-08-31 14:22 ` Petr Mladek
2026-08-21 15:26 ` [PATCH v2 2/2] kallsyms: Document why unresolved symbols are revealed Sebastian Andrzej Siewior
2026-08-26 16:21 ` Petr Mladek
2026-08-27 10:24 ` Sebastian Andrzej Siewior
2026-08-31 13:37 ` Sebastian Andrzej Siewior
2026-08-31 16:49 ` Steven Rostedt
2026-09-01 7:23 ` Petr Mladek
2026-09-01 8:01 ` Sebastian Andrzej Siewior
2026-09-01 13:30 ` Steven Rostedt
2026-08-26 14:51 ` [PATCH v2 0/2] vsprintf: Don't leak pointers Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821152614.2202196-2-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tycho@tycho.pizza \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.