Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5, 10.6, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.7(EOL), 10.8(EOL), 10.9(EOL)
-
Debian GNU/Linux AMD64, clang-13 or clang-14 -march=native -mtune=native
Description
On my system, 3 unit tests for performance_schema failed with SIGSEGV, on MariaDB Server 10.9. The reason turned out to be that the SIMD instruction MOVAPS was executed in create_thread() on a pointer that was only aligned to 128 bits (16 bytes), not the required 256 or 512 bits.
The reason turned out to be that the mocked up pfs_malloc() failed to return properly aligned memory (64 bytes or 512 bits in the case of AMD64):
diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h
|
index 8a1f9216ba2..3d7d818cc51 100644
|
--- a/storage/perfschema/unittest/stub_pfs_global.h
|
+++ b/storage/perfschema/unittest/stub_pfs_global.h
|
@@ -24,6 +24,9 @@
|
#include <my_sys.h>
|
#include <pfs_global.h>
|
#include <string.h>
|
+#ifdef HAVE_MEMALIGN
|
+# include <malloc.h>
|
+#endif
|
|
bool pfs_initialized= false;
|
|
@@ -43,7 +46,15 @@ void *pfs_malloc(size_t size, myf)
|
if (--stub_alloc_fails_after_count <= 0)
|
return NULL;
|
|
+#ifndef PFS_ALIGNEMENT
|
void *ptr= malloc(size);
|
+#elif defined HAVE_MEMALIGN
|
+ void *ptr= memalign(PFS_ALIGNEMENT, size);
|
+#elif defined HAVE_ALIGNED_MALLOC
|
+ void *ptr= _aligned_malloc(size, PFS_ALIGNEMENT);
|
+#else
|
+# error "Missing implementation"
|
+#endif
|
if (ptr != NULL)
|
memset(ptr, 0, size);
|
return ptr; |