Thread (48 messages) flat view 48 messages, 12 authors, 2017-12-07

Re: [PATCH V11 4/5] vsprintf: add printk specifier %px

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2017-11-29 23:21:02
Also in: lkml

On Wed, 29 Nov 2017 13:05:04 +1100 "Tobin C. Harding" [off-list ref] wrote:
printk specifier %p now hashes all addresses before printing. Sometimes
we need to see the actual unmodified address. This can be achieved using
%lx but then we face the risk that if in future we want to change the
way the Kernel handles printing of pointers we will have to grep through
the already existent 50 000 %lx call sites. Let's add specifier %px as a
clear, opt-in, way to print a pointer and maintain some level of
isolation from all the other hex integer output within the Kernel.

Add printk specifier %px to print the actual unmodified address.

...

+Unmodified Addresses
+====================
+
+::
+
+	%px	01234567 or 0123456789abcdef
+
+For printing pointers when you _really_ want to print the address. Please
+consider whether or not you are leaking sensitive information about the
+Kernel layout in memory before printing pointers with %px. %px is
+functionally equivalent to %lx. %px is preferred to %lx because it is more
+uniquely grep'able. If, in the future, we need to modify the way the Kernel
+handles printing pointers it will be nice to be able to find the call
+sites.
+
You might want to add a checkpatch rule which emits a stern
do-you-really-want-to-do-this warning when someone uses %px.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help