80 lines
3.4 KiB
Diff
80 lines
3.4 KiB
Diff
commit 6bb6c8a65a341a67bd059ec6e1c805813eb17264
|
|
Author: Mark Wielaard <mark@klomp.org>
|
|
Date: Tue Jun 19 18:00:45 2018 +0200
|
|
|
|
Mask AT_HWCAPS on arm64 to those instructions VEX implements.
|
|
|
|
This patch makes sure that the process running under valgrind only sees
|
|
the AES, PMULL, SHA1, SHA2, CRC32, FP, and ASIMD features in auxv AT_HWCAPS.
|
|
|
|
https://bugs.kde.org/show_bug.cgi?id=381556
|
|
|
|
diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c
|
|
index 30e1f85..61cc458 100644
|
|
--- a/coregrind/m_initimg/initimg-linux.c
|
|
+++ b/coregrind/m_initimg/initimg-linux.c
|
|
@@ -703,6 +703,19 @@ Addr setup_client_stack( void* init_sp,
|
|
(and anything above) are not supported by Valgrind. */
|
|
auxv->u.a_val &= VKI_HWCAP_S390_TE - 1;
|
|
}
|
|
+# elif defined(VGP_arm64_linux)
|
|
+ {
|
|
+ /* Limit the AT_HWCAP to just those features we explicitly
|
|
+ support in VEX. */
|
|
+#define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_AES \
|
|
+ | VKI_HWCAP_PMULL \
|
|
+ | VKI_HWCAP_SHA1 \
|
|
+ | VKI_HWCAP_SHA2 \
|
|
+ | VKI_HWCAP_CRC32 \
|
|
+ | VKI_HWCAP_FP \
|
|
+ | VKI_HWCAP_ASIMD)
|
|
+ auxv->u.a_val &= ARM64_SUPPORTED_HWCAP;
|
|
+ }
|
|
# endif
|
|
break;
|
|
# if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
|
|
diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h
|
|
index af6b435..54b0428 100644
|
|
--- a/include/vki/vki-arm64-linux.h
|
|
+++ b/include/vki/vki-arm64-linux.h
|
|
@@ -692,6 +692,39 @@ struct vki_shminfo64 {
|
|
#define VKI_TIOCSSERIAL 0x541F
|
|
|
|
//----------------------------------------------------------------------
|
|
+// From linux-4.17/include/uapi/asm-generic/ioctls.h
|
|
+//----------------------------------------------------------------------
|
|
+
|
|
+#define VKI_HWCAP_FP (1 << 0)
|
|
+#define VKI_HWCAP_ASIMD (1 << 1)
|
|
+#define VKI_HWCAP_EVTSTRM (1 << 2)
|
|
+#define VKI_HWCAP_AES (1 << 3)
|
|
+#define VKI_HWCAP_PMULL (1 << 4)
|
|
+#define VKI_HWCAP_SHA1 (1 << 5)
|
|
+#define VKI_HWCAP_SHA2 (1 << 6)
|
|
+#define VKI_HWCAP_CRC32 (1 << 7)
|
|
+#define VKI_HWCAP_ATOMICS (1 << 8)
|
|
+#define VKI_HWCAP_FPHP (1 << 9)
|
|
+#define VKI_HWCAP_ASIMDHP (1 << 10)
|
|
+#define VKI_HWCAP_CPUID (1 << 11)
|
|
+#define VKI_HWCAP_ASIMDRDM (1 << 12)
|
|
+#define VKI_HWCAP_JSCVT (1 << 13)
|
|
+#define VKI_HWCAP_FCMA (1 << 14)
|
|
+#define VKI_HWCAP_LRCPC (1 << 15)
|
|
+#define VKI_HWCAP_DCPOP (1 << 16)
|
|
+#define VKI_HWCAP_SHA3 (1 << 17)
|
|
+#define VKI_HWCAP_SM3 (1 << 18)
|
|
+#define VKI_HWCAP_SM4 (1 << 19)
|
|
+#define VKI_HWCAP_ASIMDDP (1 << 20)
|
|
+#define VKI_HWCAP_SHA512 (1 << 21)
|
|
+#define VKI_HWCAP_SVE (1 << 22)
|
|
+#define VKI_HWCAP_ASIMDFHM (1 << 23)
|
|
+#define VKI_HWCAP_DIT (1 << 24)
|
|
+#define VKI_HWCAP_USCAT (1 << 25)
|
|
+#define VKI_HWCAP_ILRCPC (1 << 26)
|
|
+#define VKI_HWCAP_FLAGM (1 << 27)
|
|
+
|
|
+//----------------------------------------------------------------------
|
|
// And that's it!
|
|
//----------------------------------------------------------------------
|
|
|