From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-doc@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>, Alex Shi <alexs@kernel.org>,
Yanteng Si <si.yanteng@linux.dev>,
Dongliang Mu <dzm91@hust.edu.cn>
Subject: [PATCH v2] Documentation/printk-formats: Remove notes about %pK
Date: Mon, 19 Oct 2026 10:30:40 +0200 [thread overview]
Message-ID: <20261019083040.Fgpb8Jz8@linutronix.de> (raw)
The %pK is slowly vanishing from drivers. The %p already prints hashed
output unless overridden at bootime. It is not obvious for the user which
output is using %pK and which does not.
Some people pointed out that this documentation encourages people to use
it so here is the removal. I also update the translation since the block
looks the same.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
I intend to send the admin-guide/sysctl/kernel.rst bits with the removal
from vsnprintf itself. I am down to 5 drivers (as of next-20261014).
If you think that this documentation should remain as long as the
interface is available then I can postpone this.
v1…v2: https://lore.kernel.org/all/20261015133553.kGn_nU-F@linutronix.de/
- Don't remove the whole %p paragraph for the zh_CN translation.
Noticed by Andy Shevchenko.
Documentation/core-api/printk-formats.rst | 20 -------------------
.../zh_CN/core-api/printk-formats.rst | 15 --------------
2 files changed, 35 deletions(-)
diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index 57e887ff24bc8..9c188d135cc6f 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -89,10 +89,6 @@ more information for debugging, use %p and boot the kernel with the
addresses unmodified. If you *really* always want the unmodified address, see
%px below.
-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.
-
Error Pointers
--------------
@@ -152,22 +148,6 @@ results in printing a string. For direct use in regular vsnprintf() the (k)
and (u) annotation is ignored, however, when used out of BPF's bpf_trace_printk(),
for example, it reads the memory it is pointing to without faulting.
-Kernel Pointers
----------------
-
-::
-
- %pK 01234567 or 0123456789abcdef
-
-For printing kernel pointers which should be hidden from unprivileged
-users. The behaviour of %pK depends on the kptr_restrict sysctl - see
-Documentation/admin-guide/sysctl/kernel.rst for more details.
-
-This modifier is *only* intended when producing content of a file read by
-userspace from e.g. procfs or sysfs, not for dmesg. Please refer to the
-section about %p above for discussion about how to manage hashing pointers
-in printk().
-
Unmodified Addresses
--------------------
diff --git a/Documentation/translations/zh_CN/core-api/printk-formats.rst b/Documentation/translations/zh_CN/core-api/printk-formats.rst
index 96a917ecc93f2..5922c8ef9b299 100644
--- a/Documentation/translations/zh_CN/core-api/printk-formats.rst
+++ b/Documentation/translations/zh_CN/core-api/printk-formats.rst
@@ -92,11 +92,6 @@ 希地址。如果不可能,而且打印地址的目的是为调试提供更
用 ``no_hash_pointers`` 参数启动内核,这将打印所有未修改的%p地址。如果你 *真的* 想知
道未修改的地址,请看下面的%px。
-如果(也只有在)你将地址作为虚拟文件的内容打印出来,例如在procfs或sysfs中(使用
-seq_printf(),而不是printk())由用户空间进程读取,使用下面描述的%pK修饰符,不
-要用%p或%px。
-
-
错误指针
--------
@@ -148,16 +143,6 @@ 来自BPF / tracing追踪的探查指针
定符的结果是打印一个字符串。对于直接在常规的vsnprintf()中使用时,(k)和(u)注释被忽略,但是,当
在BPF的bpf_trace_printk()之外使用时,它会读取它所指向的内存,不会出现错误。
-内核指针
---------
-
-::
-
- %pK 01234567 or 0123456789abcdef
-
-用于打印应该对非特权用户隐藏的内核指针。%pK的行为取决于kptr_restrict sysctl——详见
-Documentation/admin-guide/sysctl/kernel.rst。
-
未经修改的地址
--------------
--
2.55.0
reply other threads:[~2026-10-19 8:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261019083040.Fgpb8Jz8@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=alexs@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=dzm91@hust.edu.cn \
--cc=linux-doc@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=si.yanteng@linux.dev \
--cc=skhan@linuxfoundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox