-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
[DRAFT]gh-128605: Add branch protections for aarch64 in asm_trampoline.S #130864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Intel's Control-flow Technology requires manual application for the assembler files. See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
The current equivalent eh_frame for the aarch64 assembly code, generated by C code doesn't seem to properly match, although at the same time it works fine. Here is a comparison between x86_64 and aarch64. x86_64 eh_frame:
Equivalent to: cpython/Python/perf_jit_trampoline.c Lines 474 to 478 in d0ecbdd
Whereas the eh_frame for aarch64:
Equivalent to: cpython/Python/perf_jit_trampoline.c Lines 480 to 489 in d0ecbdd
|
a6fe267
to
fe6fb29
Compare
Ah wasn't taking into account the code factor alignment for aarch64. Fixed that. |
The BTI flag must be applied in assembler sources for this class of attacks to be mitigated on newer aarch64 processors. See also: https://sourceware.org/annobin/annobin.html/Test-branch-protection.html and https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/enabling-pac-and-bti-on-aarch64
fe6fb29
to
8772759
Compare
eh_frame for the new assembly which should be implemented in C: 0000000 0000000000000010 0000000 CIE 00000014 0000000000000020 00000018 FDE cie=00000000 pc=0000000000000000..000000000000001c |
This builds on top of #128606