-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-94471: Enable pointer authentication on aarch64 builds #94472
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
Conversation
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
I'll need to regenerate configure with the appropriate version of autoconf |
|
|
@erlend-aasland Looks green 👍🏻 |
|
I've attempted to simplify the M4sh here to only need AS_CASE and AX_CHECK_COMPILE_FLAG. Is this suitable? |
|
Are there potential performance issues or backwards compatibility issues with
|
There is a minor performance impact related to the CPU calculating the signed pointer, but it's on the order of the CPU doing math in hardware.
Yes, sign-return-address is a legacy option. Do you think we need to exclude the legacy option? I included it for completeness. |
I should have also stated, there isn't a backwards compatibility issue here since the instructions are implemented in the NOP space for prior architectures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would like @corona10 or another core dev to approve before merging.
|
@erlend-aasland I will take a look at this PR, I may need to understand potential impact with this patch :) |
|
@pablogsal cc @erlend-aasland cpython/Python/asm_trampoline.S Lines 17 to 25 in 1f737ed
@jgowdy Would you like to submit the pyperformance benchmark result comparing the result between |
It has potential to, specifically it may affect unwinders (including perf), debuggers and state inspection tools. We should check if the main unwinders know how to handle these pointers correctly. |
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit f08af17 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
I'm also checking with the buildbot fleet. |
|
From https://lore.kernel.org/linux-arm-kernel/Y1q914IVy6XgE1xq@hirez.programming.kicks-ass.net/t/ :
I think, if confirmed, this is a significant enough drawback that makes this a big blocker for merging this and having it active by default. It seems that someone is working on this but this email chain is very recent so I doubt most perf/libunwind versions out there will know how to handle it. In any case, we should run our own experiments to see how this affects these tools. |
|
Thanks, Dong-hee and Pablo! I'll mark this as do-not-merge, just to be on the safe side. |
|
This makes |
|
Given Dong-hee's and Pablo's valuable input on this, I believe we can conclude with that this feature is not something we can easily implement. Suggesting to close this PR and the linked issue. |
|
Agreed, also this is something that redistributors can easily do by setting CFLAGS or similar on they custom builds if they are ok sacrificing debugging / profilings capabilities. |


ARM64v8.3 supports Pointer Authentication with the PACIASP and AUTIASP instructions which are interpreted as NOP instructions on pre-8.3 architectures. These instructions sign the stack pointer and validate the stack pointer prior to return to mitigate return oriented programming.
GCC supports these options on arm64 / aarch64. The legacy option was
-msign-return-address=[all | non-leaf | none]and the modern option is-mbranch-protection=none|standard|pac-ret[+leaf+b-key]|btiI would like to suggest that the arm64 build be modified to include
-mbranch-protection=pac-retwith the-marchbeing set to ARMv8.2 or earlier or not configured, so that GCC will generate PACIASP and AUTIASP instructions. It is critical that-march=armv8.3or higher not be passed or the non-backwards compatible RETAA instruction will be generated.The benefit of enabling pointer authentication for the stack pointer on ARM64 would be to mitigate return oriented programming attacks against the CPython runtime.
Presently we (GoDaddy) are pursuing custom compiles of the CPython runtime for the new Graviton3 CPUs that support pointer authentication in AWS.