diff options
| author | Ravi Bangoria <ravi.bangoria@amd.com> | 2026-10-26 04:18:36 +0000 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2026-11-06 09:45:25 +0100 |
| commit | b61c12527223423ab66891b2e8131da0d66537c4 (patch) | |
| tree | ecbc4e1cfd663ac002a9d9154e9d723d0bf0a15f /scripts/Makefile.thinlto | |
| parent | 2c1d35bd95b13b50b43a0cb2167305dabfb54c07 (diff) | |
| download | linux-next-b61c12527223423ab66891b2e8131da0d66537c4.tar.gz linux-next-b61c12527223423ab66891b2e8131da0d66537c4.zip | |
perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR
IBS hardware captures a sample and raises an NMI. Since the NMI can be
delivered with a delay, a privilege change may occur between sample
capture and NMI delivery. Because IBS only provides the sample RIP, the
kernel records GPRs from the NMI pt_regs, which may reflect kernel mode
if a privilege switch occurred in the interim. This can leak kernel
addresses to unprivileged users through PERF_SAMPLE_REGS_USER and/or
PERF_SAMPLE_REGS_INTR.
Fix this by using interrupt regs while preparing PERF_SAMPLE_REGS_USER
and PERF_SAMPLE_REGS_INTR. With the change, when IBS samples a user mode
instruction but the NMI is delivered in kernel mode, PERF_SAMPLE_REGS_USER
will source its register state from task_pt_regs(current) and
PERF_SAMPLE_REGS_INTR will be omitted from the data sent to userspace.
In addition to fixing the kernel address leak, this change also ensures
GPR snapshot consistency, which resolves the DWARF unwinding issue with
IBS.
Closes: https://lore.kernel.org/r/CAPu-DQqF0aF6=GS8Z6KKWeeX_V5LiXeKU_rJQZC+uGg8zuTPNw@mail.gmail.com
Fixes: d29e744c7167 ("perf/x86: Relax privilege filter restriction on AMD IBS")
Reported-by: Gennady Kupava <gennady.kupava@gmail.com>
Reported-by: Jayapal Ashwin Nair <janair@amd.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20261026041838.941-3-ravi.bangoria@amd.com
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
