Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1327704

[PATCH] vsprintf: kptr_restrict is okay in IRQ when 2

From "Jason A. Donenfeld" <Jason@zx2c4.com>
Newsgroups linux.kernel
Subject [PATCH] vsprintf: kptr_restrict is okay in IRQ when 2
Date 2016-02-05 14:50 +0100
Message-ID <qYOVQ-SY-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The kptr_restrict flag, when set to 1, only prints the kernel
address when the user has CAP_SYSLOG. When it is set to 2, the
kernel address is always printed as zero. When set to 1, this
needs to check whether or not we're in IRQ. However, when set to
2, this check is unneccessary, and produces confusing results
in dmesg. Thus, only make sure we're not in IRQ when mode 1 is
used, but not mode 2.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 lib/vsprintf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 80d8ce5..fab875f 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1609,8 +1609,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 		 * %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 (kptr_restrict == 1 && (in_irq() || in_serving_softirq() ||
+				           in_nmi())) {
 			if (spec.field_width == -1)
 				spec.field_width = default_width;
 			return string(buf, end, "pK-error", spec);
-- 
2.7.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] vsprintf: kptr_restrict is okay in IRQ when 2 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-05 14:50 +0100
  Re: [PATCH] vsprintf: kptr_restrict is okay in IRQ when 2 Kees Cook <keescook@chromium.org> - 2016-02-05 21:50 +0100
    Re: [PATCH] vsprintf: kptr_restrict is okay in IRQ when 2 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-05 23:00 +0100
    [PATCH v2] vsprintf: kptr_restrict is okay in IRQ when 2 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-05 23:10 +0100
      Re: [PATCH v2] vsprintf: kptr_restrict is okay in IRQ when 2 Kees Cook <keescook@chromium.org> - 2016-02-05 23:20 +0100
        Re: [PATCH v2] vsprintf: kptr_restrict is okay in IRQ when 2 Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-07 23:00 +0100
          [PATCH v3] vsprintf: kptr_restrict is okay in IRQ when 2 "Jason A. Donenfeld" <Jason@zx2c4.com> - 2016-02-08 05:40 +0100

csiph-web