Re: [PATCH v2] perf test amd ibs: avoid using executable heap

From: Ravi Bangoria

Date: Thu Jul 02 2026 - 07:19:54 EST


> 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: 35db59fa8ea2 ("perf test amd ibs: Add sample period unit test")
> Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>

Reviewed-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>

Thanks,
Ravi