mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: David Miller <davem@davemloft.net>
Cc: torvalds@linux-foundation.org, eranian@google.com,
	acme@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] vsprintf: Turn kptr_restrict off by default
Date: Thu, 12 May 2011 23:00:28 +0200	[thread overview]
Message-ID: <20110512210028.GA16600@elte.hu> (raw)
In-Reply-To: <20110512.164319.1770509419224900253.davem@davemloft.net>


* David Miller <davem@davemloft.net> wrote:

> From: Linus Torvalds <torvalds@linux-foundation.org>
> Date: Thu, 12 May 2011 13:31:37 -0700
> 
> > That said, I have considered just reverting the thing that makes
> > kptr_restrict be 1 by default. I do like the security implications of
> > restricting visibility into kernel pointers, but I also think that
> > security rules that make the system less usable are dubious. So I
> > dunno.
> 
> We don't have any firewalling or SELINUX rules installed by default, even if 
> those features are enabled in the kernel.  Userspace asks for it.
> 
> Many people would claim that use of such things are "essential" these days.
> 
> I don't see a good reason to handle kptr_restrict any differently.

That's a good argument.

We'll fix the perf bug - i was bitten by another incarnation of it: 'perf top' 
stops showing kernel symbols and it took some time that kptr_restrict was 
turned on by default. I reported it to Arnaldo knows about it but there's no 
fix yet at the moment.

I didnt realize that perf diff got confused by this as well. (but it's logical)

So how about the patch below?

Thanks,

	Ingo

------------------------>
Subject: vsprintf: Turn kptr_restrict off by default

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.

This is how we generally handle security features that remove functionality, 
such as firewall code or SELinux - they have to be configured and activated 
from user-space.

Distributions can turn kptr_restrict on again via this line in 
/etc/sysctrl.conf:

kernel.kptr_restrict = 1

( Also mark the variable __read_mostly while at it, as it's typically modified 
  only once per bootup, or not at all. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index bc0ac6b..dfd6019 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -797,7 +797,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	return string(buf, end, uuid, spec);
 }
 
-int kptr_restrict = 1;
+int kptr_restrict __read_mostly;
 
 /*
  * Show a '%p' thing.  A kernel extension is that the '%p' is followed

  reply	other threads:[~2011-05-12 21:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 14:48 [BUG] perf: bogus correlation of kernel symbols Stephane Eranian
2011-05-12 18:06 ` David Miller
2011-05-12 18:37   ` Dave Jones
2011-05-12 19:01     ` David Miller
2011-05-12 19:58       ` Pekka Enberg
2011-05-13  6:12         ` Kees Cook
2011-05-13  6:24           ` Pekka Enberg
2011-05-12 20:24       ` Alexey Dobriyan
2011-05-12 21:06   ` Ingo Molnar
2011-05-12 20:31 ` Linus Torvalds
2011-05-12 20:43   ` David Miller
2011-05-12 21:00     ` Ingo Molnar [this message]
2011-05-12 21:08       ` [PATCH] vsprintf: Turn kptr_restrict off by default David Miller
2011-05-12 21:07   ` [BUG] perf: bogus correlation of kernel symbols Stephane Eranian
2011-05-12 21:30     ` Stephane Eranian
2011-05-12 21:35       ` Ingo Molnar
2011-05-12 21:38         ` Stephane Eranian
2011-05-12 21:50           ` Ingo Molnar
2011-05-12 21:56             ` Stephane Eranian
2011-05-12 22:00               ` Ingo Molnar
2011-05-12 22:07             ` Dave Jones
2011-05-12 22:15               ` Stephane Eranian
2011-05-13  9:01                 ` Ingo Molnar
2011-05-13  8:57               ` Ingo Molnar
2011-05-13 16:23                 ` Andi Kleen
2011-05-17 12:17                   ` Ingo Molnar
2011-05-12 21:36     ` Ingo Molnar
2011-05-12 21:41       ` Stephane Eranian
2011-05-12 21:54         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110512210028.GA16600@elte.hu \
    --to=mingo@elte.hu \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome