mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 10:02:02 +02:00
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:
|
||
|---|---|---|
| .. | ||
| amd-ibs-period.c | ||
| amd-ibs-via-core-pmu.c | ||
| arch-tests.c | ||
| bp-modify.c | ||
| Build | ||
| dwarf-unwind.c | ||
| gen-insn-x86-dat.awk | ||
| gen-insn-x86-dat.sh | ||
| hybrid.c | ||
| insn-x86-dat-32.c | ||
| insn-x86-dat-64.c | ||
| insn-x86-dat-src.c | ||
| insn-x86.c | ||
| intel-pt-test.c | ||
| regs_load.S | ||
| topdown.c | ||