diff options
author | Dan Rosenberg <drosenberg@vsecurity.com> | 2012-07-30 17:40:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:14 -0400 |
commit | 3715c5309f6d175c3053672b73fd4f73be16fd07 (patch) | |
tree | 1edebc7992a0df311b4fffc5b5f58f206a0cc2fb /lib/vsprintf.c | |
parent | 80f548e04d0b1d67d4fa8f59dbecc247f7b71c92 (diff) |
lib/vsprintf.c: kptr_restrict: fix pK-error in SysRq show-all-timers(Q)
When using ALT+SysRq+Q all the pointers are replaced with "pK-error" like
this:
[23153.208033] .base: pK-error
with echo h > /proc/sysrq-trigger it works:
[23107.776363] .base: ffff88023e60d540
The intent behind this behavior was to return "pK-error" in cases where
the %pK format specifier was used in interrupt context, because the
CAP_SYSLOG check wouldn't be meaningful. Clearly this should only apply
when kptr_restrict is actually enabled though.
Reported-by: Stevie Trujillo <stevie.trujillo@gmail.com>
Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r-- | lib/vsprintf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index a0b5f15c92cf..225aa683e175 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -1045,7 +1045,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
1045 | * %pK cannot be used in IRQ context because its test | 1045 | * %pK cannot be used in IRQ context because its test |
1046 | * for CAP_SYSLOG would be meaningless. | 1046 | * for CAP_SYSLOG would be meaningless. |
1047 | */ | 1047 | */ |
1048 | if (in_irq() || in_serving_softirq() || in_nmi()) { | 1048 | if (kptr_restrict && (in_irq() || in_serving_softirq() || |
1049 | in_nmi())) { | ||
1049 | if (spec.field_width == -1) | 1050 | if (spec.field_width == -1) |
1050 | spec.field_width = default_width; | 1051 | spec.field_width = default_width; |
1051 | return string(buf, end, "pK-error", spec); | 1052 | return string(buf, end, "pK-error", spec); |