You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/process/deprecated.rst
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,28 @@ the given limit of bytes to copy. This is inefficient and can lead to
109
109
linear read overflows if a source string is not NUL-terminated. The
110
110
safe replacement is :c:func:`strscpy`.
111
111
112
+
%p format specifier
113
+
-------------------
114
+
Traditionally, using "%p" in format strings would lead to regular address
115
+
exposure flaws in dmesg, proc, sysfs, etc. Instead of leaving these to
116
+
be exploitable, all "%p" uses in the kernel are being printed as a hashed
117
+
value, rendering them unusable for addressing. New uses of "%p" should not
118
+
be added to the kernel. For text addresses, using "%pS" is likely better,
119
+
as it produces the more useful symbol name instead. For nearly everything
120
+
else, just do not add "%p" at all.
121
+
122
+
Paraphrasing Linus's current `guidance <https://lore.kernel.org/lkml/CA+55aFwQEd_d40g4mUCSsVRZzrFPUJt74vc6PPpb675hYNXcKw@mail.gmail.com/>`_:
123
+
124
+
- If the hashed "%p" value is pointless, ask yourself whether the pointer
125
+
itself is important. Maybe it should be removed entirely?
126
+
- If you really think the true pointer value is important, why is some
127
+
system state or user privilege level considered "special"? If you think
128
+
you can justify it (in comments and commit log) well enough to stand
129
+
up to Linus's scrutiny, maybe you can use "%px", along with making sure
130
+
you have sensible permissions.
131
+
132
+
And finally, know that a toggle for "%p" hashing will `not be accepted <https://lore.kernel.org/lkml/CA+55aFwieC1-nAs+NFq9RTwaR8ef9hWa4MjNBWL41F-8wM49eA@mail.gmail.com/>`_.
133
+
112
134
Variable Length Arrays (VLAs)
113
135
-----------------------------
114
136
Using stack VLAs produces much worse machine code than statically
0 commit comments