[PATCH] Documentation/printk-formats: Remove notes about %pK
#SupersededFrom:Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:
Message-ID:<20261015133553.kGn_nU-F@linutronix.de>
Patch:v1 · 1/1
Language:zh_CN
Patch-ID:8e390c25c04aefca2f25a0f91e4dc0dd86ce62f0
Files:
Documentation/core-api/printk-formats.rstDocumentation/translations/zh_CN/core-api/printk-formats.rstLinks:lore message ↗ · raw mail ↗
Patch content 2 changed files
The %pK is slowly vanishing from drivers. The %p already prints hashedoutput unless overridden at bootime. It is not obvious for the user whichoutput is using %pK and which does not. Some people pointed out that this documentation encourages people to useit so here is the removal. I also update the translation since the blocklooks the same. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>--- I intend to send the admin-guide/sysctl/kernel.rst bits with the removalfrom vsnprintf itself. I am down to 5 drivers (as of next-20261014).If you think that this documentation should remain as long as theinterface is available then I can postpone this. Documentation/core-api/printk-formats.rst | 20 ------------ .../zh_CN/core-api/printk-formats.rst | 31 ------------------- 2 files changed, 51 deletions(-) diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rstindex 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.rstindex 96a917ecc93f2..06d139bace734 100644--- a/Documentation/translations/zh_CN/core-api/printk-formats.rst+++ b/Documentation/translations/zh_CN/core-api/printk-formats.rst@@ -76,27 +76,6 @@ 一些扩展占位符会打印给定地址上的数据,而不是打印地址 (efault) data on invalid address (einval) invalid data on a valid address -普通指针-------------::-- %p abcdef12 or 00000000abcdef12--没有指定扩展名的指针(即没有修饰符的%p)被哈希(hash),以防止内核内存布局消息的泄露。这-样还有一个额外的好处,就是提供一个唯一的标识符。在64位机器上,前32位被清零。当没有足够的-熵进行散列处理时,内核将打印(ptrval)代替--如果可能的话,使用专门的修饰符,如%pS或%pB(如下所述),以避免打印一个必须事后解释的非哈-希地址。如果不可能,而且打印地址的目的是为调试提供更多的消息,使用%p,并在调试过程中-用 ``no_hash_pointers`` 参数启动内核,这将打印所有未修改的%p地址。如果你 *真的* 想知-道未修改的地址,请看下面的%px。--如果(也只有在)你将地址作为虚拟文件的内容打印出来,例如在procfs或sysfs中(使用-seq_printf(),而不是printk())由用户空间进程读取,使用下面描述的%pK修饰符,不-要用%p或%px。-- 错误指针 -------- @@ -148,16 +127,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