linux/tools/perf/arch
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
..
alpha perf build: Remove Makefile.syscalls 2025-03-20 22:58:20 -07:00
arm perf evlist: Add reference count checking 2026-06-30 10:17:11 -07:00
arm64 perf evlist: Add reference count checking 2026-06-30 10:17:11 -07:00
csky/include perf regs: Remove __weak attributive arch__xxx_reg_mask() functions 2026-02-06 12:16:09 -03:00
loongarch perf unwind-libunwind: Make libunwind register reading cross platform 2026-05-15 16:18:36 -03:00
mips perf unwind-libunwind: Make libunwind register reading cross platform 2026-05-15 16:18:36 -03:00
parisc perf build: Remove Makefile.syscalls 2025-03-20 22:58:20 -07:00
powerpc perf dwarf: Avoid redefinition warnings for REG_DWARFNUM_NAME 2026-06-10 16:53:35 -03:00
riscv perf riscv: fix register name strings 2026-06-10 16:54:41 -03:00
s390 perf dwarf: Avoid redefinition warnings for REG_DWARFNUM_NAME 2026-06-10 16:53:35 -03:00
sh perf tools: Make more global variables static 2026-04-08 19:21:04 -07:00
sparc tools headers: Update the syscall tables and unistd.h, to support the new 'rseq_slice_yield' syscall 2026-03-05 17:20:23 -03:00
x86 perf test amd ibs: avoid using executable heap 2026-07-04 09:24:02 -07:00
xtensa tools headers: Update the syscall tables and unistd.h, to support the new 'rseq_slice_yield' syscall 2026-03-05 17:20:23 -03:00
Build perf util: Make util its own library 2024-06-26 11:07:42 -07:00
common.c perf arch common: Use perf_env e_machine rather than arch 2026-06-03 16:48:23 -03:00
common.h perf annotate: Own objdump_path and disassembler_style strings 2023-04-04 09:39:56 -03:00