about summary refs log tree commit diff
path: root/sysdeps/aarch64/multiarch/strlen.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2021-01-22 16:14:05 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2021-01-25 15:35:43 +0000
commitc3c4a25e651d4d78b1751664a613807b7140ed7e (patch)
tree34706a538d61e100227da580e9e99200ca4ffeb7 /sysdeps/aarch64/multiarch/strlen.c
parent31f64887222597bb15b7a814d8dadb7cb667bcb9 (diff)
downloadglibc-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/strlen.c')
-rw-r--r--sysdeps/aarch64/multiarch/strlen.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/sysdeps/aarch64/multiarch/strlen.c b/sysdeps/aarch64/multiarch/strlen.c
index f3c018aab4..8f38de69b5 100644
--- a/sysdeps/aarch64/multiarch/strlen.c
+++ b/sysdeps/aarch64/multiarch/strlen.c
@@ -26,21 +26,12 @@
 # include <string.h>
 # include <init-arch.h>
 
-/* This should check HWCAP2_MTE when it is available: current
-   linux kernel does not expose it, but its value is reserved.
-   This is needed to make glibc MTE-safe on future systems in
-   case user code enables MTE. The ABI contract for enabling
-   MTE is not yet specified, but it can be useful for at least
-   debugging which does not need a contract.  */
-#define FUTURE_HWCAP2_MTE (1 << 18)
-#define MTE_ENABLED() (GLRO(dl_hwcap2) & FUTURE_HWCAP2_MTE)
-
 extern __typeof (__redirect_strlen) __strlen;
 
 extern __typeof (__redirect_strlen) __strlen_mte attribute_hidden;
 extern __typeof (__redirect_strlen) __strlen_asimd attribute_hidden;
 
-libc_ifunc (__strlen, (MTE_ENABLED () ? __strlen_mte : __strlen_asimd));
+libc_ifunc (__strlen, (mte ? __strlen_mte : __strlen_asimd));
 
 # undef strlen
 strong_alias (__strlen, strlen);