linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Leo Yan <leo.yan@linaro.org>,
	coresight@lists.linaro.org, Stephen Boyd <swboyd@chromium.org>,
	Denis Nikitin <denik@chromium.org>,
	Mattias Nissler <mnissler@chromium.org>,
	Al Grant <al.grant@arm.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, jannh@google.com
Subject: Re: [PATCH 1/4] perf/core: Add support to exclude kernel mode instruction tracing
Date: Tue, 02 Feb 2021 11:41:37 +0530	[thread overview]
Message-ID: <6903bc0588a5c8e41892503a204015ee@codeaurora.org> (raw)
In-Reply-To: <YBgFDXgX57y5XzOn@hirez.programming.kicks-ass.net>

Hi Peter,

On 2021-02-01 19:11, Peter Zijlstra wrote:
> On Mon, Feb 01, 2021 at 01:11:04PM +0530, Sai Prakash Ranjan wrote:
> 
>> Ok I suppose you mean CONFIG_SECURITY_LOCKDOWN_LSM? But I don't see
>> how this new config has to depend on that? This can work independently
>> whether complete lockdown is enforced or not since it applies to only
>> hardware instruction tracing. Ideally this depends on several hardware
>> tracing configs such as ETMs and others but we don't need them because
>> we are already exposing PERF_PMU_CAP_ITRACE check in the events core.
> 
> If you don't have lockdown, root pretty much owns the kernel, or am I
> missing something?
> 

You are right in saying that without lockdown root would own kernel but
this config(EXCLUDE_KERNEL) will independently make sure that kernel
level pmu tracing is not allowed(we return -EACCES) even if LOCKDOWN
config is disabled. So I'm saying that we don't need to depend on
LOCKDOWN config, its good to have LOCKDOWN config enabled but perf
subsystem doesn't have to care about that.

>> be used for some speculative execution based attacks. Which other
>> kernel level PMUs can be used to get a full branch trace that is not
>> locked down? If there is one, then this should probably be applied to
>> it as well.
> 
> Just the regular counters. The information isn't as accurate, but given
> enough goes you can infer plenty.
> 
> Just like all the SMT size-channel attacks.
> 
> Sure, PT and friends make it even easier, but I don't see a fundamental
> distinction.

Right, we should then exclude all kernel level pmu tracing, is it fine?

if (IS_ENABLED(CONFIG_EXCLUDE_KERNEL_HW_ITRACE) && 
!attr.exclude_kernel))
     return -EACCES;

Thanks,
Sai

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

  reply	other threads:[~2021-02-02  6:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 19:05 [PATCH 0/4] Add support to exclude kernel mode hardware assisted instruction tracing Sai Prakash Ranjan
2021-01-29 19:05 ` [PATCH 1/4] perf/core: Add support to exclude kernel mode " Sai Prakash Ranjan
2021-01-29 19:30   ` Peter Zijlstra
2021-02-01  7:41     ` Sai Prakash Ranjan
2021-02-01 13:41       ` Peter Zijlstra
2021-02-02  6:11         ` Sai Prakash Ranjan [this message]
2021-02-10  7:38           ` Sai Prakash Ranjan
2021-01-29 19:05 ` [PATCH 2/4] perf evsel: Print warning for excluding " Sai Prakash Ranjan
2021-01-29 19:05 ` [PATCH 3/4] coresight: etm4x: Add support to exclude kernel mode tracing Sai Prakash Ranjan
2021-02-22 20:14   ` Doug Anderson
2021-02-24 14:51     ` Sai Prakash Ranjan
2021-01-29 19:05 ` [PATCH 4/4] coresight: etm3x: " Sai Prakash Ranjan

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=6903bc0588a5c8e41892503a204015ee@codeaurora.org \
    --to=saiprakash.ranjan@codeaurora.org \
    --cc=acme@kernel.org \
    --cc=al.grant@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=denik@chromium.org \
    --cc=jannh@google.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=mnissler@chromium.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=suzuki.poulose@arm.com \
    --cc=swboyd@chromium.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;
as well as URLs for NNTP newsgroup(s).