-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Reapply "compiler-rt: Introduce runtime functions for emulated PAC." #148094
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
Reapply "compiler-rt: Introduce runtime functions for emulated PAC." #148094
Conversation
Created using spr 1.3.6-beta.1
✅ With the latest revision this PR passed the C/C++ code formatter. |
Thanks - this version no longer seems to break my macOS build, and no longer fails the test on windows of arm64. |
Created using spr 1.3.6-beta.1
#ifdef __APPLE__ | ||
#define ASM_SYMBOL(symbol) "_" #symbol | ||
#else | ||
#define ASM_SYMBOL(symbol) #symbol | ||
#endif |
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.
For the sake of completeness, it seems there is another exception, Arm64EC ABI:
For ARM64EC functions with C linkage (whether compiled as C or by using extern "C"), a # is prepended to the decorated name.
This seems to be something Clang already knows about: for a trivial int f(void) { return 0; }
source compiled with clang -target arm64ec-windows-msvc -S -o- /tmp/arm64ec-test.c
it produces
// ...
.p2align 2
"#f": // @"#f"
.weak_anti_dep f
f = "#f"
// %bb.0: // %entry
mov w0, wzr
ret
// ...
Furthermore, some aliases are mentioned in AArch64MCInstLower.cpp. Please feel free to ignore / postpone this as long as builders are not affected.
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.
Yeah, I'm not sure what the right fix is or even if it needs a fix (ARM64EC seems to involve some sort of thunking mechanism so maybe this already works?) So let's wait to see if that is necessary.
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.
@cjacek Do you have time to try building this for ARM64EC and see if we need some change to it?
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.
Nevermind - I did manage to try building it myself. It does build fine - so that's good, not breaking anything. Not sure about the missing #
for symbol names though - it might have issues if we'd ever try to use it. But it's also quite unsure if this is relevant at all for arm64ec (which essentially emulates x86_64 ABI with native aarch64 code).
const uint64_t max_va_size = 48; | ||
const uint64_t pac_mask = ((1ULL << 55) - 1) & ~((1ULL << max_va_size) - 1); | ||
const uint64_t ttbr1_mask = 1ULL << 55; |
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.
Should be static
?
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.
Done
Created using spr 1.3.6-beta.1
…ated PAC." This reverts commit 0c0aa56. This time with the following fixes for buildbot failures: - Add underscore prefixes to symbol names on Apple platforms. - Modify the test so that it skips the crash tests on platforms where they are not expected to pass: - Platforms that implement FEAT_PAuth but not FEAT_FPAC (e.g. Apple M1, Cortex-A78C) - Platforms where DA key is disabled (e.g. older Linux kernels, Linux kernels with PAC disabled, likely Windows) Original commit message follows: The emulated PAC runtime functions emulate the ARMv8.3a pointer authentication instructions and are intended for use in heterogeneous testing environments. For more information, see the associated RFC: https://discourse.llvm.org/t/rfc-emulated-pac/85557 Reviewers: mstorsjo, pawosm-arm, atrosinenko Reviewed By: atrosinenko Pull Request: llvm/llvm-project#148094
Hi @pcc , @atrosinenko , here is failed Would you take care of it? |
This reverts commit 0c0aa56.
This time with the following fixes for buildbot failures:
they are not expected to pass:
Apple M1, Cortex-A78C)
Linux kernels with PAC disabled, likely Windows)
Original commit message follows:
The emulated PAC runtime functions emulate the ARMv8.3a pointer
authentication instructions and are intended for use in heterogeneous
testing environments. For more information, see the associated RFC:
https://discourse.llvm.org/t/rfc-emulated-pac/85557