]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf/amd/ibs: Preserve PhyAddrVal bit when clearing PhyAddr MSR
authorRavi Bangoria <ravi.bangoria@amd.com>
Mon, 16 Feb 2026 04:22:14 +0000 (04:22 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 27 Feb 2026 15:40:23 +0000 (16:40 +0100)
Commit 50a53b60e141 ("perf/amd/ibs: Prevent leaking sensitive data to
userspace") zeroed the physical address and also cleared the PhyAddrVal
flag before copying the value into a perf sample to avoid exposing
physical addresses to unprivileged users.

Clearing PhyAddrVal, however, has an unintended side-effect: several
other IBS fields are considered valid only when this bit is set. As a
result, those otherwise correct fields are discarded, reducing IBS
functionality.

Continue to zero the physical address, but keep the PhyAddrVal bit
intact so the related fields remain usable while still preventing any
address leak.

Fixes: 50a53b60e141 ("perf/amd/ibs: Prevent leaking sensitive data to userspace")
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://patch.msgid.link/20260216042216.1440-4-ravi.bangoria@amd.com
arch/x86/events/amd/ibs.c

index e0b64cb13bf9519f69285d9c4465beda9e37ae92..05b7c9f2ec338bb9e76eedb07c8e44e657d05532 100644 (file)
@@ -1217,12 +1217,10 @@ static void perf_ibs_phyaddr_clear(struct perf_ibs *perf_ibs,
                                   struct perf_ibs_data *ibs_data)
 {
        if (perf_ibs == &perf_ibs_op) {
-               ibs_data->regs[ibs_op_msr_idx(MSR_AMD64_IBSOPDATA3)] &= ~(1ULL << 18);
                ibs_data->regs[ibs_op_msr_idx(MSR_AMD64_IBSDCPHYSAD)] = 0;
                return;
        }
 
-       ibs_data->regs[ibs_fetch_msr_idx(MSR_AMD64_IBSFETCHCTL)] &= ~(1ULL << 52);
        ibs_data->regs[ibs_fetch_msr_idx(MSR_AMD64_IBSFETCHPHYSAD)] = 0;
 }