aboutsummaryrefslogtreecommitdiffstats
path: root/lib/flex_array.c
diff options
context:
space:
mode:
authorDan Rosenberg <[email protected]>2011-01-13 00:59:41 +0000
committerLinus Torvalds <[email protected]>2011-01-13 16:03:08 +0000
commit455cd5ab305c90ffc422dd2e0fb634730942b257 (patch)
treec20e6c3f8e58967991ce9002abe03d31897b171c /lib/flex_array.c
parentkernel: clean up USE_GENERIC_SMP_HELPERS (diff)
downloadkernel-455cd5ab305c90ffc422dd2e0fb634730942b257.tar.gz
kernel-455cd5ab305c90ffc422dd2e0fb634730942b257.zip
kptr_restrict for hiding kernel pointers from unprivileged users
Add the %pK printk format specifier and the /proc/sys/kernel/kptr_restrict sysctl. The %pK format specifier is designed to hide exposed kernel pointers, specifically via /proc interfaces. Exposing these pointers provides an easy target for kernel write vulnerabilities, since they reveal the locations of writable structures containing easily triggerable function pointers. The behavior of %pK depends on the kptr_restrict sysctl. If kptr_restrict is set to 0, no deviation from the standard %p behavior occurs. If kptr_restrict is set to 1, the default, if the current user (intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG (currently in the LSM tree), kernel pointers using %pK are printed as 0's. If kptr_restrict is set to 2, kernel pointers using %pK are printed as 0's regardless of privileges. Replacing with 0's was chosen over the default "(null)", which cannot be parsed by userland %p, which expects "(nil)". [[email protected]: check for IRQ context when !kptr_restrict, save an indent level, s/WARN/WARN_ONCE/] [[email protected]: coding-style fixup] [[email protected]: fix kernel/sysctl.c warning] Signed-off-by: Dan Rosenberg <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Cc: James Morris <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Thomas Graf <[email protected]> Cc: Eugene Teo <[email protected]> Cc: Kees Cook <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: David S. Miller <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Eric Paris <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/flex_array.c')
0 files changed, 0 insertions, 0 deletions