-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add initial support for ARM MTE #311
Conversation
Looks like CI works as expected. Also I think the |
I'm still trying to figure out if the |
3c98cd7
to
dd016ac
Compare
I got libia2 building in CI with a cross-compiler for aarch64 on x86. I see the preprocessor warnings I added for |
libia2/CMakeLists.txt
Outdated
@@ -3,6 +3,12 @@ project(libia2) | |||
|
|||
add_library(libia2 ia2.c threads.c main.c exit.c) | |||
target_compile_options(libia2 PRIVATE "-fPIC") | |||
if(LIBIA2_MTE) | |||
target_compile_definitions(libia2 PUBLIC IA2_USE_MTE=1) | |||
target_compile_options(libia2 PUBLIC "-march=armv8.5-a+memtag" "-ffixed-x18") |
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.
We should take a closer look at the behavior of -ffixed-x18
. In my armtest repo, even when compiling with that flag, X18 still seems to get saved and restored between function calls. System libraries also frequently alter x18, so we'll have to compile the whole shebang from libc up with this flag as well.
While working on getting CMake working with the correct compilers for each target I realized I missed some |
dd016ac
to
a62ebdc
Compare
The issue with CMake auto-adding |
eeeaacc
to
433ad5f
Compare
433ad5f
to
48295ac
Compare
48295ac
to
23bfc97
Compare
Note that the rewriter emits arch-specific assembly and this just sets the arch for the scrub registers header.
CMake has weird rules about what dependencies cause custom commands to be re-run. See the comment in ia2.cmake for details.
This PR adds
IA2_USE_MPK
andIA2_USE_MTE
macros to libia2 and replaces calls topkey_mprotect
with an arch-independent function for tagging loaded writable ELF segments with a memory key. On ARM this usesaddg
to increment a pointer through the range of pages passed tomprotect
andst2g
to tag the memory.This should already pass tests because the
#ifdef
s used in CI ignore ARM for now, but I'd like to at least build libia2 for ARM in CI before merging this.edit: nginx build failure may currently be expected(?)