Skip to content

Commit a01994f

Browse files
author
Peter Zijlstra
committed
x86/perf: Default set FREEZE_ON_SMI for all
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 <[email protected]> Suggested-by: Andrew Cooper <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 26291c5 commit a01994f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/x86/events/intel/core.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4703,6 +4703,19 @@ static __initconst const struct x86_pmu intel_pmu = {
47034703
.lbr_read = intel_pmu_lbr_read_64,
47044704
.lbr_save = intel_pmu_lbr_save,
47054705
.lbr_restore = intel_pmu_lbr_restore,
4706+
4707+
/*
4708+
* SMM has access to all 4 rings and while traditionally SMM code only
4709+
* ran in CPL0, 2021-era firmware is starting to make use of CPL3 in SMM.
4710+
*
4711+
* Since the EVENTSEL.{USR,OS} CPL filtering makes no distinction
4712+
* between SMM or not, this results in what should be pure userspace
4713+
* counters including SMM data.
4714+
*
4715+
* This is a clear privilege issue, therefore globally disable
4716+
* counting SMM by default.
4717+
*/
4718+
.attr_freeze_on_smi = 1,
47064719
};
47074720

47084721
static __init void intel_clovertown_quirk(void)

0 commit comments

Comments
 (0)