diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2020-05-15 16:09:13 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2020-05-15 16:29:06 +0200 |
commit | 69077dea25f6e7cab4ff8927e4429ad62af9de49 (patch) | |
tree | 9b9d2f32f3e1c99154b3e86e65795fd47d4834fb | |
parent | f2a944516ea8fd3de1d79d46da5aa1c8a32cd78d (diff) | |
download | mariadb-git-69077dea25f6e7cab4ff8927e4429ad62af9de49.tar.gz |
MDEV-22578 thread_pool_info crashes with clang6, using SSE instructions on unaligned memory
Apparently, in stats_reset_table(), the innocuous
memset(&group->counters, 0, sizeof(group->counters));
is converted by clang to SSE2 instructions.
The problem is that "group" is not correctly aligned,
despite MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) in the thread_group_t
declaration.
It is not aligned because it was allocated with my_malloc, since
commit fd9f1638, MDEV-5205. Previously all_groups was a
statically allocated array.
Fix is to remove MY_ALIGNED, and pad the struct instead.
-rw-r--r-- | sql/threadpool_generic.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/threadpool_generic.h b/sql/threadpool_generic.h index 64aa67c40d3..f12947cfc1e 100644 --- a/sql/threadpool_generic.h +++ b/sql/threadpool_generic.h @@ -126,7 +126,7 @@ struct thread_group_counters_t ulonglong polls[2]; }; -struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) thread_group_t +struct thread_group_t { mysql_mutex_t mutex; connection_queue_t queues[NQUEUES]; @@ -145,6 +145,7 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) thread_group_t bool shutdown; bool stalled; thread_group_counters_t counters; + char pad[CPU_LEVEL1_DCACHE_LINESIZE]; }; #define TP_INCREMENT_GROUP_COUNTER(group,var) do {group->counters.var++;}while(0) |