Skip to content

[AArch64][Docs] Add release note for execute-only support on AArch64 #134799

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

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

Il-Capitano
Copy link
Contributor

No description provided.

@Il-Capitano Il-Capitano changed the title [AArch64] Add release notes for execute-only support on AArch64 [AArch64][Docs] Add release note for execute-only support on AArch64 Apr 8, 2025
@efriedma-quic
Copy link
Collaborator

Is there a description somewhere of why you're implementing this? Last time we looked at this, we concluded it wasn't really useful. See https://reviews.llvm.org/D48791 .

@Il-Capitano
Copy link
Contributor Author

Is there a description somewhere of why you're implementing this? Last time we looked at this, we concluded it wasn't really useful. See https://reviews.llvm.org/D48791 .

I'm not sure if there's a description of the reason why this is necessary, so I'll summarize it here:

The solution that was arrived at the last time assumes that all generated code for AArch64 can be marked execute-only. However this approach has an issue with -fsanitize=function (which is a part of -fsanitize=undefined by default), which does a signature check on indirect function calls by reading two 4-byte words in front of the called function's address, causing a segmentation fault when running in execute-only mode. It seems -fsanitize=function was enabled in Clang 17 for AArch64 (godbolt), about 5 years after the initial patch you linked, so it's a fairly recent problem.

Providing a Clang font-end option (-mexecute-only/-mpure-code, used for ARM already) is necessary to diagnose this incompatibility between -fsanitize=function and execute-only code, and the linker needs to be able to deal with linking mismatched object files. The solution I've been implementing is based on the ARM backend's use of the SHF_ARM_PURECODE ELF section flag to indicate the execute-only-compatible property. A similar section flag was added to the AArch64 ELF ABI recently (ARM-software/abi-aa#304) to enable this work.

The reason why this work was started is to try to turn execute-only memory back on in Android.

Copy link
Collaborator

@smithp35 smithp35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text LGTM on the Arm side. Please leave some time for other reviewers to comment.

@Il-Capitano Il-Capitano merged commit 45f2716 into llvm:main Apr 17, 2025
11 checks passed
@Il-Capitano Il-Capitano deleted the execute-only-release-notes-llvm branch April 22, 2025 10:58
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants