Files
kernel-tenderloin-3.0/include/linux
Dan Rosenberg 455cd5ab30 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)".

[akpm@linux-foundation.org: check for IRQ context when !kptr_restrict, save an indent level, s/WARN/WARN_ONCE/]
[akpm@linux-foundation.org: coding-style fixup]
[randy.dunlap@oracle.com: fix kernel/sysctl.c warning]
Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: James Morris <jmorris@namei.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Thomas Graf <tgraf@infradead.org>
Cc: Eugene Teo <eugeneteo@kernel.org>
Cc: Kees Cook <kees.cook@canonical.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Eric Paris <eparis@parisplace.org>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-13 08:03:08 -08:00
..
2011-01-06 22:32:52 +00:00
2010-10-30 08:31:35 -07:00
2010-12-11 01:28:58 -05:00
2010-11-23 20:14:46 +00:00
2011-01-10 08:51:44 -08:00
2010-11-10 14:54:09 +01:00
2010-11-10 14:54:09 +01:00
2010-12-13 16:11:13 -08:00
2010-11-29 08:35:12 +11:00
2011-01-10 07:38:53 -08:00
2011-01-10 08:51:44 -08:00
2010-12-08 10:30:34 -08:00
2011-01-10 08:51:44 -08:00
2011-01-07 17:50:27 +11:00
2011-01-10 08:51:44 -08:00
2011-01-07 17:50:23 +11:00
2010-12-07 20:16:56 +01:00
2011-01-10 07:38:53 -08:00
2010-11-15 22:40:38 +01:00
2011-01-10 22:11:23 +01:00
2010-11-16 10:58:30 -08:00
2010-10-26 16:52:08 -07:00
2010-11-24 11:16:42 -08:00
2010-12-09 20:17:07 -08:00
2010-11-22 13:25:13 +10:00
2010-12-22 10:27:53 +01:00
2010-11-12 07:55:32 -08:00
2011-01-07 17:50:31 +11:00
2010-10-25 21:24:15 -04:00
2010-10-28 09:08:47 -05:00
2010-12-06 11:03:46 -08:00
2010-10-26 16:52:05 -07:00
2011-01-07 17:50:33 +11:00
2011-01-07 17:50:27 +11:00
2011-01-07 17:50:19 +11:00
2011-01-10 16:05:30 -08:00
2011-01-11 14:17:09 -05:00
2010-12-20 14:49:47 -05:00
2011-01-07 17:50:33 +11:00
2010-12-16 11:36:43 +01:00
2010-12-24 15:04:41 +01:00
2010-11-12 07:55:32 -08:00
2010-10-29 04:16:31 -04:00
2011-01-07 17:50:31 +11:00
2010-11-15 13:24:06 -05:00
2010-10-27 18:03:16 -07:00
2010-12-13 22:48:21 +01:00
2011-01-10 08:51:44 -08:00
2011-01-10 09:46:24 +11:00
2010-10-30 12:12:50 +02:00
2011-01-07 17:50:27 +11:00
2010-10-27 17:28:36 +01:00
2010-11-29 08:55:25 +11:00
2010-11-29 08:55:22 +11:00
2011-01-07 20:57:22 -05:00
2010-10-26 16:52:03 -07:00
2010-12-20 09:37:33 +01:00
2010-12-16 10:05:06 -08:00
2010-11-15 13:25:02 -05:00