Skip to contentSkip to conversation

Documentation/printk-formats: Remove notes about %pK

PATCH Applied Sebastian Andrzej Siewior 3 participants 5 messages Oct 19 – Nov 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Documentation/printk-formats: Remove notes about %pK

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.

---

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/[email protected]/
- 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(-)
Documentation/core-api/printk-formats.rst +0 -20
index 57e887ff24bc8..9c188d135cc6f 100644
@@ -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
 --------------------
 
Documentation/translations/zh_CN/core-api/printk-formats.rst +0 -15
index 96a917ecc93f2..5922c8ef9b299 100644
@@ -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。
-
 未经修改的地址
 --------------
 
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Sebastian Andrzej Siewior

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.

Looks good to me:

Quoted 6 lines

---

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.

Good question. IMHO, it would be better to wait until all users are gone. The people reviwing the removal patches might want to see what the modifier does. I think that the documentation does not increase much the risk of adding new users.

Best Regards,
Petr

maintainer Applied
#2 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 16 lines · Sebastian Andrzej Siewior

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.

---

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.

Quoted 7 lines

v1…v2: https://lore.kernel.org/all/[email protected]/
- 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(-)

Applied, thanks.

jon

maintainer Reviewed-by on v2 1/1
#3 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 9 lines · Sebastian Andrzej Siewior

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.

Just for record. The change looks good:

Note: It seems that Jonathan already took this patch. The plan was to
push this after the last users were removed. But it is not a big deal when it goes in earlier by the documentation tree.

Best Regards,
Petr

maintainer
#4 lore raw
Quoted 11 lines · Petr Mladek
Quoted 9 lines · Sebastian Andrzej Siewior

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.

Quoted 7 lines

Just for record. The change looks good:

Note: It seems that Jonathan already took this patch. The plan was to
push this after the last users were removed. But it is not a big deal when it goes in earlier by the documentation tree.

You'd sent a Reviewed-by on October 21; I took that as a signal that I should pick it up. Apologies if I misunderstood.

jon