]> sourceware.org Git - glibc.git/commitdiff
aarch64: Use future HWCAP2_MTE in ifunc resolver
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 24 Jul 2020 11:37:23 +0000 (12:37 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Mon, 27 Jul 2020 11:54:22 +0000 (12:54 +0100)
Make glibc MTE-safe on systems where MTE is available. This allows
using heap tagging with an LD_PRELOADed malloc implementation that
enables MTE. We don't document this as guaranteed contract yet, so
glibc may not be MTE safe when HWCAP2_MTE is set (older glibcs
certainly aren't). This is mainly for testing and debugging.

The HWCAP flag is not exposed in public headers until Linux adds it
to its uapi. The HWCAP value reservation will be in Linux 5.9.

sysdeps/aarch64/multiarch/strlen.c

index 7c0352dd878086708ac785807bc4d210b85e528f..9440decf75b0928a5cb2d548abf1620ce4cbf043 100644 (file)
 # include <string.h>
 # include <init-arch.h>
 
-/* This should check HWCAP_MTE when it is available.  */
-#define MTE_ENABLED() (false)
+/* 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;
 
This page took 0.03927 seconds and 5 git commands to generate.