vsprintf: Check real user/group id for %pK
Subsystems (3)
PATCH v2 1/1 vsprintf: Check real user/group id for %pK
Some setuid binaries will allow reading of files which have read permission by the real user id. This is problematic with files which use %pK because the file access permission is checked at open() time, but the kptr_restrict setting is checked at read() time. If a setuid binary opens a %pK file as an unprivileged user, and then elevates permissions before reading the file, then kernel pointer values may be leaked.
This happens for example with the setuid pppd application on Ubuntu 12.04:
$ head -1 /proc/kallsyms 00000000 T startup_32
$ pppd file /proc/kallsyms pppd: In file /proc/kallsyms: unrecognized option 'c1000000'
This will only leak the pointer value from the first line, but other setuid binaries may leak more information.
Fix this by adding a check that in addition to the current process having CAP_SYSLOG, that effective user and group ids are equal to the real ids. If a setuid binary reads the contents of a file which uses %pK then the pointer values will be printed as NULL if the real user is unprivileged.
---
Changes since v1:
* Fix the description to say 'vsprintf' instead of 'printk'.
* Clarify the open() vs read() time checks in the patch description and
code comment.
* Remove comment about 'badly written' setuid binaries. This occurs
with setuids binaries which correctly handle opening files.
* Added extra people to the Cc list.
---
lib/vsprintf.c +20 -4
@@ -1312,10 +1312,26 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, spec.field_width = default_width;return string (buf, end,"pK-error" , spec); } -if (!((kptr_restrict ==0 ) || - (kptr_restrict ==1 && -has_capability_noaudit (current,CAP_SYSLOG )))) - ptr =NULL ; + +/* +* If kptr_restrict is set to 2, then %pK always prints as +* NULL. If it is set to 1, then only print the real pointer +* value if the current proccess has CAP_SYSLOG and is running +* with the same credentials it started with. This is because +* access to files is checked at open() time, but %pK checks +* permission at read() time. We don't want to leak pointer +* values if a binary opens a file using %pK and then elevates +* privileges before reading it. +*/ + { +const struct cred *cred =current_cred (); + +if (kptr_restrict ==2 || (kptr_restrict ==1 && + (!has_capability_noaudit (current,CAP_SYSLOG ) || + !uid_eq (cred->euid, cred->uid) || + !gid_eq (cred->egid, cred->gid)))) + ptr =NULL ; + }break ;case 'N' :switch (fmt[1 ]) {
Quoted 7 lines · Ryan Mallon
Some setuid binaries will allow reading of files which have read permission by the real user id. This is problematic with files which use %pK because the file access permission is checked at
open()time, but thekptr_restrictsetting is checked atread()time. If a setuid binary opens a %pK file as an unprivileged user, and then elevates permissions before reading the file, then kernel pointer values may be leaked.
I think it should explicitly test 0.
Dan? Might this be any problem?
Otherwise, just style notes:
lib/vsprintf.c
Quoted 1 line
lib/vsprintf.c +0
-0
[]
Quoted 11 lines
lib/vsprintf.c +3
-4@@ -1312,10 +1312,26 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, spec.field_width = default_width;return string (buf, end,"pK-error" , spec); } -if (!((kptr_restrict ==0 ) || - (kptr_restrict ==1 && -has_capability_noaudit (current,CAP_SYSLOG )))) - ptr =NULL ; + +/* +* If kptr_restrict is set to 2, then %pK always prints as
lib/vsprintf.c char *pointer(const char *fmt, char *buf, char *end, void *ptr, · line 1327
Quoted 10 lines
lib/vsprintf.c +10
-0+* NULL. If it is set to 1, then only print the real pointer +* value if the current proccess has CAP_SYSLOG and is running +* with the same credentials it started with. This is because +* access to files is checked at open() time, but %pK checks +* permission at read() time. We don't want to leak pointer +* values if a binary opens a file using %pK and then elevates +* privileges before reading it. +*/ + { +const struct cred *cred =current_cred ();
Please add #include <linux/cred.h>
lib/vsprintf.c char *pointer(const char *fmt, char *buf, char *end, void *ptr, · line 1335
Quoted 7 lines
lib/vsprintf.c +6
-0+if (kptr_restrict ==2 || (kptr_restrict ==1 && + (!has_capability_noaudit (current,CAP_SYSLOG ) || + !uid_eq (cred->euid, cred->uid) || + !gid_eq (cred->egid, cred->gid)))) + ptr =NULL ; + }break ;
Also, it might be easier to read as:
if (kptr_restrict == 0)
break;
else if (kptr_restrict == 1) {
const struct cred *cred = current_cred();
if (!has_capability_noaudit(current, CAP_SYSLOG) ||
!uid_eq(cred->euid, cred->uid) ||
!gid_eq(cred->egid, cred->gid))
ptr = NULL;
} else {
ptr = NULL;
}
break;Quoted 2 lines
lib/vsprintf.c +0
-0case 'N' :switch (fmt[1 ]) {
Quoted 10 lines · Joe Perches
Quoted 7 lines · Ryan Mallon
Some setuid binaries will allow reading of files which have read permission by the real user id. This is problematic with files which use %pK because the file access permission is checked at
open()time, but thekptr_restrictsetting is checked atread()time. If a setuid binary opens a %pK file as an unprivileged user, and then elevates permissions before reading the file, then kernel pointer values may be leaked.I think it should explicitly test 0.
Also, Documentation/sysctl/kernel.txt should be updated too.
Here's a suggested patch:
--- Documentation/sysctl/kernel.txt | 14 ++++++++------ lib/vsprintf.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 18 deletions(-)
Documentation/sysctl/kernel.txt +8 -6
@@ -290,13 +290,15 @@ Default value is "/sbin/hotplug". kptr_restrict: This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers +exposing kernel addresses via /proc and other interfaces. + +When kptr_restrict is set to (0), there are no restrictions. +When kptr_restrict is set to (1), the default, kernel pointers printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +unless the user has CAP_SYSLOG and effective user and group ids +are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using +%pK will be replaced with 0's regardless of privileges. ==============================================================
lib/vsprintf.c +26 -12
@@ -27,6 +27,7 @@#include <linux/uaccess.h> #include <linux/ioport.h> #include <linux/dcache.h> +#include <linux/cred.h> #include <net/addrconf.h> #include <asm/page.h> /* for PAGE_SIZE */
@@ -1302,20 +1303,33 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,return buf; }case 'K' : -/* -* %pK cannot be used in IRQ context because its test -* for CAP_SYSLOG would be meaningless. -*/ -if (kptr_restrict && (in_irq () ||in_serving_softirq () || -in_nmi ())) { -if (spec.field_width ==-1 ) - spec.field_width = default_width; -return string (buf, end,"pK-error" , spec); +switch (kptr_restrict) { +case 0 :/* None */ +break ; +case 1 : {/* Restricted (the default) */ +const struct cred *cred; + +if (in_irq () ||in_serving_softirq () ||in_nmi ()) { +/* +* This cannot be used in IRQ context because +* the test for CAP_SYSLOG would be meaningless +*/ +if (spec.field_width ==-1 ) + spec.field_width = default_width; +return string (buf, end,"pK-error" , spec); + } + cred =current_cred (); +if (!has_capability_noaudit (current,CAP_SYSLOG ) || + !uid_eq (cred->euid, cred->uid) || + !gid_eq (cred->egid, cred->gid)) + ptr =NULL ; +break ; } -if (!((kptr_restrict ==0 ) || - (kptr_restrict ==1 && -has_capability_noaudit (current,CAP_SYSLOG )))) +case 2 :/* Forbidden - Always 0 */ +default : ptr =NULL ; +break ; + }break ;case 'N' :switch (fmt[1 ]) {
Quoted 34 lines · Joe Perches
Quoted 10 lines · Joe Perches
Quoted 7 lines · Ryan Mallon
Some setuid binaries will allow reading of files which have read permission by the real user id. This is problematic with files which use %pK because the file access permission is checked at
open()time, but thekptr_restrictsetting is checked atread()time. If a setuid binary opens a %pK file as an unprivileged user, and then elevates permissions before reading the file, then kernel pointer values may be leaked.I think it should explicitly test 0.
Also,
Documentation/sysctl/kernel.txtshould be updated too.Here's a suggested patch:
--- Documentation/sysctl/kernel.txt | 14 ++++++++------ lib/vsprintf.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 18 deletions(-)Documentation/sysctl/kernel.txt +2
-3@@ -290,13 +290,15 @@ Default value is "/sbin/hotplug". kptr_restrict: This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers +exposing kernel addresses via /proc and other interfaces. +
Documentation/sysctl/kernel.txt Default value is "/sbin/hotplug". · line 301
Quoted 10 lines
Documentation/sysctl/kernel.txt +6
-3+When kptr_restrict is set to (0), there are no restrictions. +When kptr_restrict is set to (1), the default, kernel pointers printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +unless the user has CAP_SYSLOG and effective user and group ids +are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using +%pK will be replaced with 0's regardless of privileges.
I'll add this, thanks.
I'm less fussed about the suggestions for the logic. The current test is small and concise. The original also does the in_irq tests regardless of the kptr_restrict setting since they are mostly intended to catch internal kernel bugs.
Anyway, I am mostly interested to hear if the solution is acceptable, or if a more involved open() vs read() time check is required.
~Ryan
Quoted 63 lines
Documentation/sysctl/kernel.txt +0
-0==============================================================lib/vsprintf.c +26
-12@@ -27,6 +27,7 @@#include <linux/uaccess.h> #include <linux/ioport.h> #include <linux/dcache.h> +#include <linux/cred.h> #include <net/addrconf.h> #include <asm/page.h> /* for PAGE_SIZE */ @@ -1302,20 +1303,33 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,return buf; }case 'K' : -/* -* %pK cannot be used in IRQ context because its test -* for CAP_SYSLOG would be meaningless. -*/ -if (kptr_restrict && (in_irq () ||in_serving_softirq () || -in_nmi ())) { -if (spec.field_width ==-1 ) - spec.field_width = default_width; -return string (buf, end,"pK-error" , spec); +switch (kptr_restrict) { +case 0 :/* None */ +break ; +case 1 : {/* Restricted (the default) */ +const struct cred *cred; + +if (in_irq () ||in_serving_softirq () ||in_nmi ()) { +/* +* This cannot be used in IRQ context because +* the test for CAP_SYSLOG would be meaningless +*/ +if (spec.field_width ==-1 ) + spec.field_width = default_width; +return string (buf, end,"pK-error" , spec); + } + cred =current_cred (); +if (!has_capability_noaudit (current,CAP_SYSLOG ) || + !uid_eq (cred->euid, cred->uid) || + !gid_eq (cred->egid, cred->gid)) + ptr =NULL ; +break ; } -if (!((kptr_restrict ==0 ) || - (kptr_restrict ==1 && -has_capability_noaudit (current,CAP_SYSLOG )))) +case 2 :/* Forbidden - Always 0 */ +default : ptr =NULL ; +break ; + }break ;case 'N' :switch (fmt[1 ]) {
Quoted 48 lines · Ryan Mallon
Quoted 34 lines · Joe Perches
Quoted 10 lines · Joe Perches
Quoted 7 lines · Ryan Mallon
Some setuid binaries will allow reading of files which have read permission by the real user id. This is problematic with files which use %pK because the file access permission is checked at
open()time, but thekptr_restrictsetting is checked atread()time. If a setuid binary opens a %pK file as an unprivileged user, and then elevates permissions before reading the file, then kernel pointer values may be leaked.I think it should explicitly test 0.
Also,
Documentation/sysctl/kernel.txtshould be updated too.Here's a suggested patch:
--- Documentation/sysctl/kernel.txt | 14 ++++++++------ lib/vsprintf.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 18 deletions(-)Documentation/sysctl/kernel.txt +2
-3@@ -290,13 +290,15 @@ Default value is "/sbin/hotplug". kptr_restrict: This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers +exposing kernel addresses via /proc and other interfaces. +Documentation/sysctl/kernel.txt Default value is "/sbin/hotplug". · line 301
Quoted 10 lines
Documentation/sysctl/kernel.txt +6
-3+When kptr_restrict is set to (0), there are no restrictions. +When kptr_restrict is set to (1), the default, kernel pointers printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +unless the user has CAP_SYSLOG and effective user and group ids +are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using +%pK will be replaced with 0's regardless of privileges.I'll add this, thanks.
Quoted 2 lines
I'm less fussed about the suggestions for the logic. The current test is small and concise.
The logic ends up the same to the compiler, but it's human readers that want simple and clear.
Quoted 3 lines
The original also does the
in_irqtests regardless of thekptr_restrictsetting since they are mostly intended to catch internal kernel bugs.
Not so.
http://marc.info/?l=linux-security-module&m=129303800912245&w=4
https://lkml.org/lkml/2012/7/13/428
Quoted 51 lines · Joe Perches
Quoted 45 lines · Ryan Mallon
Quoted 32 lines · Joe Perches
Quoted 9 lines · Joe Perches
Quoted 7 lines · Ryan Mallon
Some setuid binaries will allow reading of files which have read permission by the real user id. This is problematic with files which use %pK because the file access permission is checked at
open()time, but thekptr_restrictsetting is checked atread()time. If a setuid binary opens a %pK file as an unprivileged user, and then elevates permissions before reading the file, then kernel pointer values may be leaked.I think it should explicitly test 0.
Also,
Documentation/sysctl/kernel.txtshould be updated too.Here's a suggested patch:
--- Documentation/sysctl/kernel.txt | 14 ++++++++------ lib/vsprintf.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 18 deletions(-)Documentation/sysctl/kernel.txt +2
-3@@ -290,13 +290,15 @@ Default value is "/sbin/hotplug". kptr_restrict: This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers +exposing kernel addresses via /proc and other interfaces. +Documentation/sysctl/kernel.txt Default value is "/sbin/hotplug". · line 301
Quoted 10 lines
Documentation/sysctl/kernel.txt +6
-3+When kptr_restrict is set to (0), there are no restrictions. +When kptr_restrict is set to (1), the default, kernel pointers printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +unless the user has CAP_SYSLOG and effective user and group ids +are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using +%pK will be replaced with 0's regardless of privileges.I'll add this, thanks.
Quoted 2 lines
I'm less fussed about the suggestions for the logic. The current test is small and concise.
The logic ends up the same to the compiler, but it's human readers that want simple and clear.
Quoted 8 lines
Quoted 3 lines
The original also does the
in_irqtests regardless of thekptr_restrictsetting since they are mostly intended to catch internal kernel bugs.Not so.
http://marc.info/?l=linux-security-module&m=129303800912245&w=4
https://lkml.org/lkml/2012/7/13/428
Ah, I misread it. It does however check when kptr_restrict != 0, not just when kptr_restrict is 1. I've left the in_irq test as-is, but used a switch as suggested. I don't really care either way, I think the original check is quite readable. Anyway, updated patch below:
~Ryan
---
Documentation/sysctl/kernel.txt +8 -6
@@ -290,13 +290,15 @@ Default value is "/sbin/hotplug". kptr_restrict: This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers +exposing kernel addresses via /proc and other interfaces. + +When kptr_restrict is set to (0), there are no restrictions. +When kptr_restrict is set to (1), the default, kernel pointers printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +unless the user has CAP_SYSLOG and effective user and group ids +are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using +%pK will be replaced with 0's regardless of privileges. ==============================================================
lib/vsprintf.c +29 -3
@@ -27,6 +27,7 @@#include <linux/uaccess.h> #include <linux/ioport.h> #include <linux/dcache.h> +#include <linux/cred.h> #include <net/addrconf.h> #include <asm/page.h> /* for PAGE_SIZE */
@@ -1312,11 +1313,36 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, spec.field_width = default_width;return string (buf, end,"pK-error" , spec); } -if (!((kptr_restrict ==0 ) || - (kptr_restrict ==1 && -has_capability_noaudit (current,CAP_SYSLOG )))) + +switch (kptr_restrict) { +case 0 : +/* Always print %pK values */ +break ; +case 1 : { +/* +* Only print the real pointer value if the current +* proccess has CAP_SYSLOG and is running with the +* same credentials it started with. This is because +* access to files is checked at open() time, but %pK +* checks permission at read() time. We don't want to +* leak pointer values if a binary opens a file using +* %pK and then elevates privileges before reading it. +*/ +const struct cred *cred =current_cred (); + +if (!has_capability_noaudit (current,CAP_SYSLOG ) || + !uid_eq (cred->euid, cred->uid) || + !gid_eq (cred->egid, cred->gid)) + ptr =NULL ; +break ; + } +default : +/* Always print 0's for %pK */ ptr =NULL ; +break ; + }break ; +case 'N' :switch (fmt[1 ]) {case 'F' :
Quoted 1 line · Ryan Mallon
Anyway, updated patch below:
nit:
lib/vsprintf.c
Quoted 1 line
lib/vsprintf.c +0
-0
[]
Quoted 6 lines
lib/vsprintf.c +0
-2@@ -1312,11 +1313,36 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, spec.field_width = default_width;return string (buf, end,"pK-error" , spec); } - if (!((kptr_restrict == 0) || - (kptr_restrict == 1 &&
lib/vsprintf.c char *pointer(const char *fmt, char *buf, char *end, void *ptr, · line 1324
Quoted 10 lines
lib/vsprintf.c +9
-1- has_capability_noaudit(current, CAP_SYSLOG)))) + +switch (kptr_restrict) { +case 0 : +/* Always print %pK values */ +break ; +case 1 : { +/* +* Only print the real pointer value if the current +* proccess has CAP_SYSLOG and is running with the
s/proccess/process/ typo
Quoted 6 lines · Ryan Mallon
Ah, I misread it. It does however check when
kptr_restrict!= 0, not just whenkptr_restrictis 1. I've left thein_irqtest as-is, but used a switch as suggested. I don't really care either way, I think the original check is quite readable. Anyway, updated patch below:~Ryan
This seems mostly fine to me, except the "proccess" -> "process" nit Joe already identified.
I think I also prefer Joe's style of having an explicit "case 2" in the switch statement in addition to the default case for clarity.
Also, isn't the default value of kptr_restrict 0 now, unless I'm missing something? If I recall it was 1 when originally written, and then changed to 0 at some point. Could the documentation be updated to reflect that?
-Dan
Quoted 85 lines
---
Documentation/sysctl/kernel.txt +8
-6@@ -290,13 +290,15 @@ Default value is "/sbin/hotplug". kptr_restrict: This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers +exposing kernel addresses via /proc and other interfaces. + +When kptr_restrict is set to (0), there are no restrictions. +When kptr_restrict is set to (1), the default, kernel pointers printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +unless the user has CAP_SYSLOG and effective user and group ids +are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using +%pK will be replaced with 0's regardless of privileges. ==============================================================lib/vsprintf.c +29
-3@@ -27,6 +27,7 @@#include <linux/uaccess.h> #include <linux/ioport.h> #include <linux/dcache.h> +#include <linux/cred.h> #include <net/addrconf.h> #include <asm/page.h> /* for PAGE_SIZE */ @@ -1312,11 +1313,36 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, spec.field_width = default_width;return string (buf, end,"pK-error" , spec); } -if (!((kptr_restrict ==0 ) || - (kptr_restrict ==1 && -has_capability_noaudit (current,CAP_SYSLOG )))) + +switch (kptr_restrict) { +case 0 : +/* Always print %pK values */ +break ; +case 1 : { +/* +* Only print the real pointer value if the current +* proccess has CAP_SYSLOG and is running with the +* same credentials it started with. This is because +* access to files is checked at open() time, but %pK +* checks permission at read() time. We don't want to +* leak pointer values if a binary opens a file using +* %pK and then elevates privileges before reading it. +*/ +const struct cred *cred =current_cred (); + +if (!has_capability_noaudit (current,CAP_SYSLOG ) || + !uid_eq (cred->euid, cred->uid) || + !gid_eq (cred->egid, cred->gid)) + ptr =NULL ; +break ; + } +default : +/* Always print 0's for %pK */ ptr =NULL ; +break ; + }break ; +case 'N' :switch (fmt[1 ]) {case 'F' :
Quoted 4 lines · Dan Rosenberg
isn't the default value of
kptr_restrict0 now, unless I'm missing something? If I recall it was 1 when originally written, and then changed to 0 at some point. Could the documentation be updated to reflect that?
Yeah, the default got changed by
---------------------------
commit 411f05f123cbd7f8aa1edcae86970755a6e2a9d9
Author: Ingo Molnar <[email protected]> Date: Thu May 12 23:00:28 2011 +0200
kptr_restrict has been triggering bugs in apps such as perf, and it also makes the system less useful by default, so turn it off by default.
---------------------------
Maybe this:
--- Documentation/sysctl/kernel.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
Documentation/sysctl/kernel.txt +9 -8
@@ -289,14 +289,15 @@ Default value is "/sbin/hotplug". kptr_restrict: -This toggle indicates whether restrictions are placed on -exposing kernel addresses via /proc and other interfaces. When -kptr_restrict is set to (0), there are no restrictions. When -kptr_restrict is set to (1), the default, kernel pointers -printed using the %pK format specifier will be replaced with 0's -unless the user has CAP_SYSLOG. When kptr_restrict is set to -(2), kernel pointers printed using %pK will be replaced with 0's -regardless of privileges. +This toggle indicates whether restrictions are placed on exposing kernel +addresses via /proc and other interfaces. + +When kptr_restrict is set to (0), the default, there are no restrictions. +When kptr_restrict is set to (1), kernel pointers printed using the %pK +format specifier will be replaced with 0's unless the user has CAP_SYSLOG +and effective user and group ids are equal to the real ids. +When kptr_restrict is set to (2), kernel pointers printed using %pK will +be replaced with 0's regardless of privileges. ==============================================================