-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
[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
|
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. |
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 |
8772759 to
8519ff1
Compare
|
You might add a NEWS entry using blurb or blurb-it, see: https://devguide.python.org/ |
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
8519ff1 to
1728096
Compare
|
Noting here that while the protections are enabled with this PR, Perf unwinding which includes the Python functions does not work without Frame Pointers. For that the And they should match this .eh_frame: Haven't yet figured the correct way to do that though as utilizing the way that the ARM abi describes it by using 0x2D for DW_CFA_AARCH64_negate_ra_state, doesn't work. |
|
@diegorusso might be able to help, or at least know someone |
|
@stratakis and I have been discussed this in the past. I'm not sure what the status is. Do you need further help? |
|
I haven't managed to make any progress yet. I took a look again recently but it's not possible to test it till #139544 is resolved. |
This builds on top of #128606