Skip to content

Commit

Permalink
doc: add documentation on printing kernel addresses
Browse files Browse the repository at this point in the history
Hashing addresses printed with printk specifier %p was implemented
recently. During development a number of issues were raised regarding
leaking kernel addresses to userspace. Other documentation was updated but
security/self-protection missed out.

Add self-protection documentation regarding printing kernel addresses.

Signed-off-by: Tobin C. Harding <[email protected]>
Signed-off-by: Jonathan Corbet <[email protected]>
  • Loading branch information
tcharding authored and Jonathan Corbet committed Dec 21, 2017
1 parent da27140 commit 227d1a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Documentation/security/self-protection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,21 @@ attacks, it is important to defend against exposure of both kernel memory
addresses and kernel memory contents (since they may contain kernel
addresses or other sensitive things like canary values).

Kernel addresses
----------------

Printing kernel addresses to userspace leaks sensitive information about
the kernel memory layout. Care should be exercised when using any printk
specifier that prints the raw address, currently %px, %p[ad], (and %p[sSb]
in certain circumstances [*]). Any file written to using one of these
specifiers should be readable only by privileged processes.

Kernels 4.14 and older printed the raw address using %p. As of 4.15-rc1
addresses printed with the specifier %p are hashed before printing.

[*] If KALLSYMS is enabled and symbol lookup fails, the raw address is
printed. If KALLSYMS is not enabled the raw address is printed.

Unique identifiers
------------------

Expand Down

0 comments on commit 227d1a6

Please sign in to comment.