diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-01-22 16:14:05 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-01-25 15:35:43 +0000 |
commit | c3c4a25e651d4d78b1751664a613807b7140ed7e (patch) | |
tree | 34706a538d61e100227da580e9e99200ca4ffeb7 /sysdeps/aarch64/multiarch/init-arch.h | |
parent | 31f64887222597bb15b7a814d8dadb7cb667bcb9 (diff) | |
download | glibc-c3c4a25e651d4d78b1751664a613807b7140ed7e.tar.gz glibc-c3c4a25e651d4d78b1751664a613807b7140ed7e.tar.xz glibc-c3c4a25e651d4d78b1751664a613807b7140ed7e.zip |
aarch64: Move and update the definition of MTE_ENABLED
The hwcap value is now in linux 5.10 and in glibc bits/hwcap.h, so use that definition. Move the definition to init-arch.h so all ifunc selectors can use it and expose an "mte" shorthand for mte enabled runtime. For now we allow user code to enable tag checks and use PROT_MTE mappings without libc involvment, this is not guaranteed ABI, but can be useful for testing and debugging with MTE.
Diffstat (limited to 'sysdeps/aarch64/multiarch/init-arch.h')
-rw-r--r-- | sysdeps/aarch64/multiarch/init-arch.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h index bf8264b561..fce260d168 100644 --- a/sysdeps/aarch64/multiarch/init-arch.h +++ b/sysdeps/aarch64/multiarch/init-arch.h @@ -17,9 +17,18 @@ <https://www.gnu.org/licenses/>. */ #include <ldsodefs.h> +#include <sys/auxv.h> + +/* Make glibc MTE-safe on a system that supports MTE in case user code + enables tag checks independently of the mte_status of glibc. There + is currently no ABI contract for enabling tag checks in user code, + but this can be useful for debugging with MTE. */ +#define MTE_ENABLED() (GLRO(dl_hwcap2) & HWCAP2_MTE) #define INIT_ARCH() \ uint64_t __attribute__((unused)) midr = \ GLRO(dl_aarch64_cpu_features).midr_el1; \ unsigned __attribute__((unused)) zva_size = \ - GLRO(dl_aarch64_cpu_features).zva_size; + GLRO(dl_aarch64_cpu_features).zva_size; \ + bool __attribute__((unused)) mte = \ + MTE_ENABLED (); |