mariadb/mysys
Karthik Kamath 8bc828b982 BUG#26502135: MYSQLD SEGFAULTS IN
MDL_CONTEXT::TRY_ACQUIRE_LOCK_IMPL

ANALYSIS:
=========
Server sometimes exited when multiple threads tried to
acquire and release metadata locks simultaneously (for
example, necessary to access a table). The same problem
could have occurred when new objects were registered/
deregistered in Performance Schema.

The problem was caused by a bug in LF_HASH - our lock free
hash implementation which is used by metadata locking
subsystem in 5.7 branch. In 5.5 and 5.6 we only use LF_HASH
in Performance Schema Instrumentation implementation. So
for these versions, the problem was limited to P_S.

The problem was in my_lfind() function, which searches for
the specific hash element by going through the elements
list. During this search it loads information about element
checked such as key pointer and hash value into local
variables. Then it confirms that they are not corrupted by
concurrent delete operation (which will set pointer to 0)
by checking if element is still in the list. The latter
check did not take into account that compiler (and
processor) can reorder reads in such a way that load of key
pointer will happen after it, making result of the check
invalid.

FIX:
====
This patch fixes the problem by ensuring that no such
reordering can take place. This is achieved by using
my_atomic_loadptr() which contains compiler and processor
memory barriers for the check mentioned above and other
similar places.

The default (for non-Windows systems) implementation of
my_atomic*() relies on old __sync intrisics and implements
my_atomic_loadptr() as read-modify operation. To avoid
scalability/performance penalty associated with addition of
my_atomic_loadptr()'s we change the my_atomic*() to use
newer __atomic intrisics when available. This new default
implementation doesn't have such a drawback.
2017-11-27 19:59:29 +05:30
..
array.c
base64.c
ChangeLog
charset-def.c
charset.c
checksum.c
CMakeLists.txt Backport from trunk: 2014-05-07 17:09:14 +02:00
default.c Bug#23072792 MYSQL_GROUP_SUFFIX DOES NOT WORK 2017-09-08 16:48:15 +02:00
errors.c Bug#23251517: SEMISYNC REPLICATION HANGING 2016-05-13 16:42:45 +05:30
hash.c
lf_alloc-pin.c
lf_dynarray.c
lf_hash.c BUG#26502135: MYSQLD SEGFAULTS IN 2017-11-27 19:59:29 +05:30
list.c
md5.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mf_arr_appstr.c Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
mf_cache.c
mf_dirname.c
mf_fn_ext.c
mf_format.c
mf_getdate.c
mf_iocache.c
mf_iocache2.c Bug#18207212 : FILE NAME IS NOT ESCAPED IN BINLOG FOR LOAD DATA INFILE STATEMENT 2014-05-15 15:50:52 +05:30
mf_keycache.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mf_keycaches.c
mf_loadpath.c Bug# 20376760: STACK-BUFFER-OVERFLOW WITH LONG PATHS TO CERTAIN VARIABLES 2015-06-24 17:48:46 +05:30
mf_pack.c
mf_path.c
mf_qsort.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mf_qsort2.c Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
mf_radix.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mf_same.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mf_sort.c
mf_soundex.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mf_tempdir.c Bug#16316074 RFE: MAKE TMPDIR A BUILD-TIME CONFIGURABLE OPTION 2013-12-18 11:05:18 +01:00
mf_tempfile.c Bug#16316074 RFE: MAKE TMPDIR A BUILD-TIME CONFIGURABLE OPTION 2013-12-18 11:05:18 +01:00
mf_unixpath.c
mf_wcomp.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
mulalloc.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_access.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_aes.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_alarm.c Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
my_alloc.c
my_atomic.c
my_bit.c
my_bitmap.c
my_chsize.c
my_compare.c
my_compress.c
my_conio.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_copy.c
my_crc32.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_create.c
my_delete.c
my_div.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_error.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_file.c
my_fopen.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_fstream.c
my_gethwaddr.c
my_getncpus.c
my_getopt.c Bug #21503595 : --QUERY-ALLOC-BLOCK-SIZE=-1125899906842624 + 2015-09-04 11:10:57 +05:30
my_getpagesize.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_getsystime.c
my_getwd.c
my_handler_errors.h
my_init.c
my_largepage.c
my_lib.c
my_libwrap.c Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
my_lock.c
my_lockmem.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_malloc.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_memmem.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_mess.c
my_mkdir.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_mmap.c
my_new.cc
my_once.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_open.c
my_pread.c
my_pthread.c
my_quick.c
my_rdtsc.c
my_read.c Merge from mysql-5.1 to mysql-5.5 2013-03-28 14:18:51 +05:30
my_redel.c Bug#24388746: PRIVILEGE ESCALATION AND RACE CONDITION USING CREATE TABLE 2016-08-19 09:09:07 +02:00
my_rename.c
my_seek.c
my_sleep.c
my_static.c
my_static.h
my_symlink.c BUG#25451091:CREATE TABLE DATA DIRECTORY / INDEX DIRECTORY 2017-05-12 09:47:48 +05:30
my_symlink2.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_sync.c
my_thr_init.c Bug #17514920 MYSQL_THREAD_INIT() CALL WITHOUT MYSQL_INIT() IS CRASHING IN WINDOWS 2014-04-23 12:46:00 +03:00
my_timer_cycles.il
my_wincond.c Bug#21770366 backport bug#21657078 to 5.5 and 5.6 2016-01-26 09:18:10 +01:00
my_windac.c
my_winerr.c
my_winfile.c
my_winthread.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
my_write.c Bug#23251517: SEMISYNC REPLICATION HANGING 2016-05-13 16:42:45 +05:30
mysys_priv.h
ptr_cmp.c Bug#19660891 HANDLE_FATAL_SIGNAL (SIG=11) IN QUEUE_INSERT 2015-06-17 13:44:32 +02:00
queues.c
rijndael.c
sha1.c Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
stacktrace.c
string.c
test_charset.c
test_dir.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
test_xml.c Updated/added copyright headers 2014-01-06 10:52:35 +05:30
testhash.c
thr_alarm.c Bug#19974500: SERVER 5.5 / DEBUG DOESN\'T COMPILE WITH GCC 4.9.1 2014-11-06 12:14:05 +01:00
thr_lock.c
thr_mutex.c
thr_rwlock.c
tree.c BUG#22594514: HANDLE_FATAL_SIGNAL (SIG=11) IN 2016-03-17 08:49:37 +05:30
typelib.c