docs: add documentation on printing kernel addresses
PATCH 1/1 docs: add documentation on printing kernel addresses
Hashing addresses printed with printk specifier %p was implemented recently. During development a number of issues were raised regarding leaking kernel addresses to userspace. We should update the documentation appropriately.
Add documentation regarding printing kernel addresses.
---
Is there a proffered method for subscripts in sphinx kernel docs? Here we use '[*]'
thanks,
Tobin.
Documentation/security/self-protection.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Documentation/security/self-protection.rst +14 -0
@@ -270,6 +270,20 @@ 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 symbol lookup fails, the raw address is currently printed. + Unique identifiers ------------------
Signature · 1 line
2.7.4
Quoted 8 lines · Tobin C. Harding
Hashing addresses printed with printk specifier %p was implemented recently. During development a number of issues were raised regarding leaking kernel addresses to userspace. We should update the documentation appropriately.
Add documentation regarding printing kernel addresses.
Signed-off-by Tobin C. Harding <[email protected]>
Quoted 4 lines
---
Is there a proffered method for subscripts in sphinx kernel docs? Here we use '[*]'
Great question... I can't find an answer to this. :P
Quoted 18 lines
thanks,
Tobin.Documentation/security/self-protection.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/security/self-protection.rst +3
-0@@ -270,6 +270,20 @@ 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 +---------------- +
Documentation/security/self-protection.rst attacks, it is important to defend against exposure of both kernel memory · line 285
Quoted 10 lines
Documentation/security/self-protection.rst +10
-0+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 symbol lookup fails, the raw address is currently printed.
Is there a plan to adjust this case?
Thanks!
-Kees
Quoted 7 lines
Documentation/security/self-protection.rst +1
-1+ Unique identifiers ------------------ --2.7.4
Signature · 2 lines
Kees Cook Pixel Security
Quoted 34 lines · Kees Cook
Quoted 8 lines · Tobin C. Harding
Hashing addresses printed with printk specifier %p was implemented recently. During development a number of issues were raised regarding leaking kernel addresses to userspace. We should update the documentation appropriately.
Add documentation regarding printing kernel addresses.
Signed-off-by Tobin C. Harding <[email protected]>Acked-by Kees Cook <[email protected]>Quoted 4 lines
---
Is there a proffered method for subscripts in sphinx kernel docs? Here we use '[*]'
Great question... I can't find an answer to this. :P
Quoted 15 lines
thanks,
Tobin.Documentation/security/self-protection.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/security/self-protection.rst +0
-0@@ -270,6 +270,20 @@ 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).
Quoted 15 lines
Documentation/security/self-protection.rst attacks, it is important to defend against exposure of both kernel memory · line 285
Quoted 13 lines
Documentation/security/self-protection.rst +13
-0+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 symbol lookup fails, the raw address is currently printed.Is there a plan to adjust this case?
RFC is in flight at the moment
[RFC 0/3] kallsyms: don't leak address when printing symbol
You commented already that you liked it. Had no response from Steve, I was intending to give him two weeks and then put in the patch for real.
Or I could put it in without the ftrace stuff and just break tracing - just kidding, I wouldn't do that :)
thanks,
Tobin.
Please drop this patch, needs amendment (commented inline).
Quoted 30 lines · Tobin C. Harding
Hashing addresses printed with printk specifier %p was implemented recently. During development a number of issues were raised regarding leaking kernel addresses to userspace. We should update the documentation appropriately.
Add documentation regarding printing kernel addresses.
Signed-off-by Tobin C. Harding <[email protected]>---
Is there a proffered method for subscripts in sphinx kernel docs? Here we use '[*]'
thanks,
Tobin.Documentation/security/self-protection.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/security/self-protection.rst +3
-0@@ -270,6 +270,20 @@ 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 +---------------- +
Documentation/security/self-protection.rst attacks, it is important to defend against exposure of both kernel memory · line 285
Quoted 10 lines
Documentation/security/self-protection.rst +10
-0+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 symbol lookup fails, the raw address is currently printed.
[*] If KALLSYMS is enabled and symbol lookup fails, the raw address is currently printed. If KALLSYMS is not enabled the address is printed.
thanks,
Tobin.