From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Kyle Huey <me@kylehuey.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
open list <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org,
"H. Peter Anvin" <hpa@zytor.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>, Dave Hansen <dave.hansen@linux.intel.com>,
Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Robert O'Callahan <rocallahan@gmail.com>,
Keno Fischer <keno@juliacomputing.com>,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] x86/perf: Default freeze_on_smi on for Comet Lake and later.
Date: Tue, 25 Jan 2022 08:57:09 -0500 [thread overview]
Message-ID: <7ef1bf66-4184-7f5b-c0bd-351ec743d4e9@linux.intel.com> (raw)
In-Reply-To: <CAP045ArbX7cYKyv0H4X2SxUJWycB1VoLZWLME=_RXttBFBfP3A@mail.gmail.com>
On 1/24/2022 9:59 PM, Kyle Huey wrote:
> On Mon, Jan 24, 2022 at 8:01 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
>>
>>
>>
>> On 1/24/2022 7:21 AM, Peter Zijlstra wrote:
>>> On Fri, Jan 21, 2022 at 11:26:44PM -0800, Kyle Huey wrote:
>>>> Beginning in Comet Lake, Intel extended the concept of privilege rings to
>>>> SMM.[0] A side effect of this is that events caused by execution of code
>>>> in SMM are now visible to performance counters with IA32_PERFEVTSELx.USR
>>>> set.
>>>>
>>>> rr[1] depends on exact counts of performance events for the user space
>>>> tracee, so this change in behavior is fatal for us. It is, however, easily
>>>> corrected by setting IA32_DEBUGCTL.FREEZE_WHILE_SMM to 1 (visible in sysfs
>>>> as /sys/devices/cpu/freeze_on_smi). While we can and will tell our users to
>>>> set freeze_on_smi manually when appropriate, because observing events in
>>>> SMM is rarely useful to anyone, we propose to change the default value of
>>>> this switch.
>>
>> + Andi
>>
>> From we heard many times from sophisticated customers, they really hate
>> blind spots. They want to see everything. That's why we set
>> freeze_on_smi to 0 as default. I think the patch breaks the principle.
>
> The default kernel settings for perf events prioritize preventing
> information leaks to less privileged code. perf_event_paranoid
> defaults to 2, preventing unprivileged users from observing kernel
> space. If "sophisticated customers" want to see everything they have
> already needed privileges (or an explicit opt-in through decreasing
> perf_event_paranoid) for some time.
>
> The current situation on Comet Lake+ where an unprivileged user
> *cannot* observe kernel code due to security concerns but
> simultaneously *must* observe SMM code seems rather absurd.
>
I see. I was thought the unprivileged user can observe the SMM code on
the previous platforms. The CML+ change only makes part of the SMM code
CPL0. Seems I'm wrong. The change looks like changing the previous CPL0
code to CPL3 code. If so, yes, I think we should prevent the information
leaks for the unprivileged user.
>> I don't think there is a way to notify all the users that the default
>> kernel value will be changed. (Yes, the end user can always check the
>> /sys/devices/cpu/freeze_on_smi to get the latest value. But in practice,
>> no one checks it unless some errors found.) I think it may bring
>> troubles to the users if they rely on the counts in SMM.
>
> Unfortunately the new hardware has already changed the behavior
> without notifying users, no matter what we do here.
>
>> The patch only changes the default values for some platforms, not all
>> platforms. The default value is not consistent among platforms anymore.
>> It can bring confusion.
>
> I don't personally object to changing freeze_on_smi for all platforms
> :) I was merely trying to limit the changes.
Changing it to all platforms seems a too big hammer. I agree we should
limit it to the impacted platforms.
I've contacted the author of the white paper. I was told that the change
is for the client vPro platforms. They are not sure whether it impacts
Server platform or Atom platforms. I'm still working on it. I will let
you and Peter know once I get more information.
Thanks,
Kan
next prev parent reply other threads:[~2022-01-25 14:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-22 7:26 [PATCH] x86/perf: Default freeze_on_smi on for Comet Lake and later Kyle Huey
2022-01-24 12:21 ` Peter Zijlstra
2022-01-24 16:00 ` Liang, Kan
2022-01-24 16:30 ` Peter Zijlstra
2022-01-24 17:03 ` Liang, Kan
2022-01-24 17:16 ` Peter Zijlstra
2022-01-25 2:59 ` Kyle Huey
2022-01-25 13:57 ` Liang, Kan [this message]
2022-01-26 14:04 ` Peter Zijlstra
2022-01-26 14:58 ` Liang, Kan
2022-01-27 2:22 ` Andrew Cooper
2022-01-27 11:31 ` Peter Zijlstra
2022-01-27 11:56 ` Andrew Cooper
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=7ef1bf66-4184-7f5b-c0bd-351ec743d4e9@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=keno@juliacomputing.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=me@kylehuey.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rocallahan@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.