mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jeff Vander Stoep <jeffv@google.com>
Cc: kernel-hardening@lists.openwall.com, mingo@redhat.com,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] security, perf: Add config option to restrict perf_event_open
Date: Tue, 2 Aug 2016 11:55:46 +0200	[thread overview]
Message-ID: <20160802095546.GE6862@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1469630783-32413-1-git-send-email-jeffv@google.com>

On Wed, Jul 27, 2016 at 07:46:23AM -0700, Jeff Vander Stoep wrote:
> +++ b/kernel/events/core.c
> @@ -355,7 +355,11 @@ static struct srcu_struct pmus_srcu;
>   *   2 - disallow kernel profiling for unpriv
>   *   3 - disallow all unpriv perf event use
>   */
> +#ifdef CONFIG_SECURITY_PERF_EVENTS_RESTRICT
> +int sysctl_perf_event_paranoid __read_mostly = 3;
> +#else
>  int sysctl_perf_event_paranoid __read_mostly = 2;
> +#endif
>  
>  /* Minimum for 512 kiB + 1 user control page */
>  int sysctl_perf_event_mlock __read_mostly = 512 + (PAGE_SIZE / 1024); /* 'free' kiB per user */
> diff --git a/security/Kconfig b/security/Kconfig
> index df28f2b..2a93551 100644
> --- a/security/Kconfig
> +++ b/security/Kconfig
> @@ -18,6 +18,15 @@ config SECURITY_DMESG_RESTRICT
>  
>  	  If you are unsure how to answer this question, answer N.
>  
> +config SECURITY_PERF_EVENTS_RESTRICT
> +	bool "Restrict unprivileged use of performance events"
> +	depends on PERF_EVENTS
> +	help
> +	  If you say Y here, the kernel.perf_event_paranoid sysctl
> +	  will be set to 3 by default, and no unprivileged use of the
> +	  perf_event_open syscall will be permitted unless it is
> +	  changed.

NAK.

Apart from the fact that I hate the 3 thing this is not how you do
default CONFIG knobs for !bool state variables.

Use an "int" config not a "bool" config and allow all options to be
default.

  parent reply	other threads:[~2016-08-02  9:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 14:46 Jeff Vander Stoep
2016-07-27 20:43 ` Kees Cook
2016-08-02  9:55 ` Peter Zijlstra [this message]
2016-08-02 15:19   ` [kernel-hardening] " Kees Cook

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=20160802095546.GE6862@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jeffv@google.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /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