linux/tools/perf/arch/x86/tests
Ondrej Mosnacek e34006e743 perf test amd ibs: avoid using executable heap
Making [parts of] the heap executable is dangerous and is blocked by
SELinux on Fedora/RHEL even for an unconfined user. Replace the malloc()
+ mprotect() combo with just mmap(), creating a private anonymous rwx
mapping, which only requires the more commonly allowed "execmem"
permission under SELinux (things like JIT or regex compilation need it
as well). mmap() with MAP_ANONYMOUS will give us a zeroed mapping that
begins on a page boundary, so the result is equivalent to the original
code even without a memset() or the page-alignment dance.

Verified that the test still passes on a machine with an AMD CPU that
has the "ibs" CPU flag.

Fixes: 35db59fa8e ("perf test amd ibs: Add sample period unit test")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Reviewed-by: Ravi Bangoria <ravi.bangoria@amd.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-07-04 09:24:02 -07:00
..
amd-ibs-period.c perf test amd ibs: avoid using executable heap 2026-07-04 09:24:02 -07:00
amd-ibs-via-core-pmu.c perf tools changes and fixes for v6.5: 1st batch 2023-06-30 11:35:41 -07:00
arch-tests.c perf build: Remove NO_AUXTRACE build option 2025-11-13 23:03:11 -08:00
bp-modify.c perf tools: Switch printf("...%s", strerror(errno)) to printf("...%m") 2026-01-14 17:22:50 -03:00
Build perf build: Remove NO_AUXTRACE build option 2025-11-13 23:03:11 -08:00
dwarf-unwind.c perf tools: Use calloc() where applicable 2026-04-08 19:21:05 -07:00
gen-insn-x86-dat.awk
gen-insn-x86-dat.sh perf arch x86: Add shellcheck to build 2024-04-12 17:54:02 -03:00
hybrid.c perf evlist: Add reference count checking 2026-06-30 10:17:11 -07:00
insn-x86-dat-32.c perf tests: Add APX and other new instructions to x86 instruction decoder test 2024-06-25 11:06:19 -07:00
insn-x86-dat-64.c perf tests: Add APX and other new instructions to x86 instruction decoder test 2024-06-25 11:06:19 -07:00
insn-x86-dat-src.c perf tests: Add APX and other new instructions to x86 instruction decoder test 2024-06-25 11:06:19 -07:00
insn-x86.c perf test x86: insn-x86 test data is immutable so mark it const 2023-05-28 10:21:13 -03:00
intel-pt-test.c perf intel-pt: Use the perf provided "cpuid.h" 2025-11-13 23:03:11 -08:00
regs_load.S perf bench: Update the copies of x86's mem{cpy,set}_64.S 2019-12-02 11:40:57 -03:00
topdown.c perf evlist: Add reference count 2026-06-30 10:17:10 -07:00