linux/arch/x86/events/perf_event_flags.h
Ravi Bangoria b0a0914262 perf/amd/ibs: Avoid calling perf_allow_kernel() from the IBS NMI handler
Calling perf_allow_kernel() from the NMI context is unsafe and could be
fatal. Capture the permission at event-initialization time by storing it
in event->hw.flags, and have the NMI handler rely on that cached flag
instead of making the call directly.

Fixes: 50a53b60e1 ("perf/amd/ibs: Prevent leaking sensitive data to userspace")
Reported-by: Sadasivan Shaiju <sadasivan.shaiju2@amd.com>
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-5-ravi.bangoria@amd.com
2026-02-27 16:40:23 +01:00

27 lines
1.5 KiB
C

/*
* struct hw_perf_event.flags flags
*/
PERF_ARCH(PEBS_LDLAT, 0x0000001) /* ld+ldlat data address sampling */
PERF_ARCH(PEBS_ST, 0x0000002) /* st data address sampling */
PERF_ARCH(PEBS_ST_HSW, 0x0000004) /* haswell style datala, store */
PERF_ARCH(PEBS_LD_HSW, 0x0000008) /* haswell style datala, load */
PERF_ARCH(PEBS_NA_HSW, 0x0000010) /* haswell style datala, unknown */
PERF_ARCH(EXCL, 0x0000020) /* HT exclusivity on counter */
PERF_ARCH(DYNAMIC, 0x0000040) /* dynamic alloc'd constraint */
PERF_ARCH(PEBS_CNTR, 0x0000080) /* PEBS counters snapshot */
PERF_ARCH(EXCL_ACCT, 0x0000100) /* accounted EXCL event */
PERF_ARCH(AUTO_RELOAD, 0x0000200) /* use PEBS auto-reload */
PERF_ARCH(LARGE_PEBS, 0x0000400) /* use large PEBS */
PERF_ARCH(PEBS_VIA_PT, 0x0000800) /* use PT buffer for PEBS */
PERF_ARCH(PAIR, 0x0001000) /* Large Increment per Cycle */
PERF_ARCH(LBR_SELECT, 0x0002000) /* Save/Restore MSR_LBR_SELECT */
PERF_ARCH(TOPDOWN, 0x0004000) /* Count Topdown slots/metrics events */
PERF_ARCH(PEBS_STLAT, 0x0008000) /* st+stlat data address sampling */
PERF_ARCH(AMD_BRS, 0x0010000) /* AMD Branch Sampling */
PERF_ARCH(PEBS_LAT_HYBRID, 0x0020000) /* ld and st lat for hybrid */
PERF_ARCH(NEEDS_BRANCH_STACK, 0x0040000) /* require branch stack setup */
PERF_ARCH(BRANCH_COUNTERS, 0x0080000) /* logs the counters in the extra space of each branch */
PERF_ARCH(ACR, 0x0100000) /* Auto counter reload */
PERF_ARCH(UNPRIVILEGED, 0x0200000) /* Unprivileged event (wrt perf_allow_kernel()) */