Skip to content

Commit dd274cf

Browse files
Peter Zijlstragregkh
authored andcommitted
x86/perf: Default set FREEZE_ON_SMI for all
commit a01994f upstream. Kyle reported that rr[0] has started to malfunction on Comet Lake and later CPUs due to EFI starting to make use of CPL3 [1] and the PMU event filtering not distinguishing between regular CPL3 and SMM CPL3. Since this is a privilege violation, default disable SMM visibility where possible. Administrators wanting to observe SMM cycles can easily change this using the sysfs attribute while regular users don't have access to this file. [0] https://rr-project.org/ [1] See the Intel white paper "Trustworthy SMM on the Intel vPro Platform" at https://bugzilla.kernel.org/attachment.cgi?id=300300, particularly the end of page 5. Reported-by: Kyle Huey <me@kylehuey.com> Suggested-by: Andrew Cooper <Andrew.Cooper3@citrix.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: stable@kernel.org Link: https://lkml.kernel.org/r/YfKChjX61OW4CkYm@hirez.programming.kicks-ass.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 456f041 commit dd274cf

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

arch/x86/events/intel/core.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4353,6 +4353,19 @@ static __initconst const struct x86_pmu intel_pmu = {
43534353
.lbr_read = intel_pmu_lbr_read_64,
43544354
.lbr_save = intel_pmu_lbr_save,
43554355
.lbr_restore = intel_pmu_lbr_restore,
4356+
4357+
/*
4358+
* SMM has access to all 4 rings and while traditionally SMM code only
4359+
* ran in CPL0, 2021-era firmware is starting to make use of CPL3 in SMM.
4360+
*
4361+
* Since the EVENTSEL.{USR,OS} CPL filtering makes no distinction
4362+
* between SMM or not, this results in what should be pure userspace
4363+
* counters including SMM data.
4364+
*
4365+
* This is a clear privilege issue, therefore globally disable
4366+
* counting SMM by default.
4367+
*/
4368+
.attr_freeze_on_smi = 1,
43564369
};
43574370

43584371
static __init void intel_clovertown_quirk(void)

0 commit comments

Comments
 (0)