gh-144194: Fix mmap failure check in perf_jit_trampoline.c (#143713)
mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current
check never detects mmap failures, so jitdump initialization proceeds
even when the memory mapping fails.
(cherry picked from commit 8fe8a94a7c050bc16cac9ec300f89c0f389f9a44)
Co-authored-by: stratakis <cstratak@redhat.com>
gh-142779: Initialize reserved field for proper padding (GH-142780)
The jitdump specification specifies a reserved field for padding.
Initialize it so no garbage data is embedded in the jitdump files.
(cherry picked from commit 77bf4ba732a8736910bd6b7ec5a58b8ee833c95f)
Co-authored-by: stratakis <cstratak@redhat.com>
This commit fixes the following problems:
* The x86_64 trampolines are not preserving frame pointers
* The hardcoded offsets to the code segment from the FDE only worked properly for x64_64
* The CIE data was not following conventions of aarch64
* The eh_frame for aarch64 was not fully correct
(cherry picked from commit 236f733d8ffb3d587e1167fa0a0248c24512e7fd)
Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S.
Required for mitigation against return-oriented programming (ROP)
and Call or Jump Oriented Programming (COP/JOP) attacks.
Manual application is required for the assembly files.
See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
[3.14] gh-128605: Revert "Add branch protections for x86_64 in asm_tr…ampoline.S (GH-128606) (GH-135077)" (GH-135175)
This reverts commit 899cca6dbf76bf3e06a99f60a5f996ad6ba0761f,
which broke buildbots.
(cherry picked from commit b477e21d5cb85bc764d6d9d18d122aa703d7b548)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
[3.14] gh-128605: Add branch protections for x86_64 in asm_trampoline.S (GH-128606) (GH-135077)
Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S.
Required for mitigation against return-oriented programming (ROP)
and Call or Jump Oriented Programming (COP/JOP) attacks.
Manual application is required for the assembly files.
See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
(cherry picked from commit 899cca6dbf76bf3e06a99f60a5f996ad6ba0761f)
Co-authored-by: stratakis <cstratak@redhat.com>