84 lines
3.1 KiB
Diff
84 lines
3.1 KiB
Diff
commit fdb3ddfe4e372022adcc1093f7f28d49021662ce
|
|
Author: Nicolas Morey <nmorey@suse.com>
|
|
Date: Mon Dec 2 09:44:02 2024 +0100
|
|
|
|
psm3: prevent code from building using AVX/AVX2
|
|
|
|
Even with a snippet detecting if the CPU is compatible, PSM3 uses multiple
|
|
constructors which may trigger a SIGILL when the library gets loaded
|
|
|
|
Signed-off-by: Nicolas Morey <nmorey@suse.com>
|
|
|
|
diff --git prov/psm3/configure.m4 prov/psm3/configure.m4
|
|
index 5c8c083f7dc0..88e6871c1a9e 100644
|
|
--- prov/psm3/configure.m4
|
|
+++ prov/psm3/configure.m4
|
|
@@ -125,49 +125,7 @@ AC_DEFUN([FI_PSM3_CONFIGURE],[
|
|
],[
|
|
psm3_happy=0
|
|
AC_MSG_RESULT([no])
|
|
- AC_MSG_NOTICE([psm3 requires minimum of avx instruction set to build])
|
|
- ])
|
|
- CFLAGS=$save_CFLAGS
|
|
-
|
|
- AC_MSG_CHECKING([for -mavx support])
|
|
- save_CFLAGS=$CFLAGS
|
|
- CFLAGS="$PSM3_STRIP_OPTFLAGS -mavx -O0"
|
|
- AC_LINK_IFELSE(
|
|
- [AC_LANG_PROGRAM(
|
|
- [[#include <immintrin.h>]],
|
|
- [[unsigned long long _a[4] = {1ULL,2ULL,3ULL,4ULL};
|
|
- __m256i vA = _mm256_loadu_si256((__m256i *)_a);
|
|
- __m256i vB;
|
|
- _mm256_store_si256(&vB, vA);
|
|
- return 0;]])
|
|
- ],[
|
|
- AC_MSG_RESULT([yes])
|
|
- PSM3_ARCH_CFLAGS="-mavx"
|
|
- PSM3_MARCH="avx"
|
|
- ],[
|
|
- psm3_happy=0
|
|
- AC_MSG_RESULT([no])
|
|
- AC_MSG_NOTICE([psm3 requires minimum of avx instruction set to build])
|
|
- ])
|
|
- CFLAGS=$save_CFLAGS
|
|
-
|
|
- AC_MSG_CHECKING([for -mavx2 support])
|
|
- save_CFLAGS=$CFLAGS
|
|
- CFLAGS="$PSM3_STRIP_OPTFLAGS -mavx2 -O0"
|
|
- AC_LINK_IFELSE(
|
|
- [AC_LANG_PROGRAM(
|
|
- [[#include <immintrin.h>]],
|
|
- [[unsigned long long _a[4] = {1ULL,2ULL,3ULL,4ULL};
|
|
- __m256i vA = _mm256_loadu_si256((__m256i *)_a);
|
|
- __m256i vB = _mm256_add_epi64(vA, vA);
|
|
- (void)vB;
|
|
- return 0;]])
|
|
- ],[
|
|
- AC_MSG_RESULT([yes])
|
|
- PSM3_ARCH_CFLAGS="-mavx2"
|
|
- PSM3_MARCH="avx2"
|
|
- ],[
|
|
- AC_MSG_RESULT([no])
|
|
+ AC_MSG_NOTICE([psm3 requires minimum of SSE4.2 instruction set to build])
|
|
])
|
|
CFLAGS=$save_CFLAGS
|
|
|
|
diff --git prov/psm3/src/psmx3_init.c prov/psm3/src/psmx3_init.c
|
|
index 29359d3ea348..a02c1ff8698b 100644
|
|
--- prov/psm3/src/psmx3_init.c
|
|
+++ prov/psm3/src/psmx3_init.c
|
|
@@ -685,10 +685,8 @@ static int psmx3_getinfo(uint32_t api_version, const char *node,
|
|
PSMX3_INFO(&psmx3_prov, FI_LOG_CORE,
|
|
"CPU does not support '%s'.\n", PSM3_MARCH);
|
|
OFI_INFO_STR(&psmx3_prov,
|
|
- (__builtin_cpu_supports("avx2") ? "AVX2" :
|
|
- (__builtin_cpu_supports("avx") ? "AVX" :
|
|
- (__builtin_cpu_supports("sse4.2") ? "SSE4.2" : "unknown"))),
|
|
- PSM3_MARCH, "CPU Supports", "PSM3 Built With");
|
|
+ __builtin_cpu_supports("sse4.2") ? "SSE4.2" : "unknown",
|
|
+ PSM3_MARCH, "CPU Supports", "PSM3 Built With");
|
|
goto err_out;
|
|
}
|
|
|