Skip to content

Commit 656c700

Browse files
author
Tor Didriksen
committed
Bug #31364927 LDAP TESTS DOES NOT DO CLEAN SHUTDOWN OF SERVER
The server may segfault during the last stages of cleanup during shutdown after unloading the auth LDAP plugin. This is because the ldap library will configure SSL to use locking callbacks in the LDAP library. After unloading libldap, these callbacks point to non-existant code. For valgrind builds, we add a dependency on the server executable to ldap, ensuring that ldap will not be unloaded when unloading plugins. This allows valgrind to see the suppressions we have in valgrind.supp. For OpenSSL in the 1.0.x series we also add the dependency, to ensure clean shutdown of the server. Generalized some valgrind suppressions to match misc OS/compiler combinations. Change-Id: I6264bda57e0498bf552ed9c805b350724a2dbc5c
1 parent b654ff8 commit 656c700

File tree

2 files changed

+41
-60
lines changed

2 files changed

+41
-60
lines changed

mysql-test/valgrind.supp

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2005, 2020, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0,
@@ -60,7 +60,7 @@
6060
Memcheck:Leak
6161
fun:memalign
6262
...
63-
fun:tls_get_addr_tail
63+
fun:tls_get_addr_tail*
6464
}
6565

6666
{
@@ -122,6 +122,16 @@
122122
fun:pthread_create*
123123
}
124124

125+
{
126+
pthread allocate_dtv memory loss third
127+
Memcheck:Leak
128+
match-leak-kinds: reachable
129+
fun:malloc
130+
fun:allocate_dtv_entry
131+
...
132+
fun:exit
133+
}
134+
125135
{
126136
pthread memalign memory loss
127137
Memcheck:Leak
@@ -1931,15 +1941,9 @@
19311941
{
19321942
LDAP_TLS_workaround3
19331943
Memcheck:Leak
1934-
fun:calloc
1935-
fun:PR_LoadLibraryWithFlags
1936-
...
1937-
...
1938-
...
1939-
fun:PR_CallOnce
1940-
...
1944+
match-leak-kinds: reachable
19411945
...
1942-
fun:_dl_init
1946+
fun:PR_LoadLibraryWithFlags
19431947
}
19441948
{
19451949
LDAP_TLS_workaround4
@@ -1984,31 +1988,26 @@
19841988
{
19851989
LDAP_TLS_workaround6
19861990
Memcheck:Leak
1991+
match-leak-kinds: reachable
19871992
fun:malloc
19881993
fun:ber_memalloc_x
19891994
fun:ber_strdup_x
19901995
...
19911996
fun:ldap_int_initialize
19921997
fun:ldap_create
19931998
fun:ldap_initialize
1994-
fun:*create*
19951999
}
19962000
{
19972001
LDAP_TLS_workaround7
19982002
Memcheck:Leak
19992003
fun:malloc
20002004
fun:*dl_close_worker*
20012005
fun:*dl_close*
2002-
fun:*dl_catch_error*
20032006
...
20042007
fun:*free_mem*
20052008
fun:*libc_freeres*
20062009
fun:*vgnU_freeres*
20072010
fun:*run_exit_handlers*
2008-
fun:exit*
2009-
fun:*mysqld_exit*
2010-
fun:*mysqld_main*
2011-
fun:*main*
20122011
}
20132012
{
20142013
LDAP_TLS_workaround8
@@ -2019,25 +2018,21 @@
20192018
...
20202019
fun:ldap_int_initialize
20212020
fun:ldap_set_option
2022-
fun:*configure_tls*
20232021
}
20242022
{
20252023
LDAP_TLS_workaround9
20262024
Memcheck:Leak
20272025
match-leak-kinds: reachable
20282026
fun:malloc
2029-
fun:PR_ErrorInstallTable
2030-
...
2031-
...
2032-
...
2033-
...
2034-
...
2035-
...
2036-
...
2037-
...
2038-
...
2039-
...
20402027
...
2028+
fun:ldap_int_tls_start
2029+
fun:ldap_start_tls_s
2030+
}
2031+
{
2032+
LDAP_TLS_workaround10
2033+
Memcheck:Leak
2034+
match-leak-kinds: reachable
2035+
fun:calloc
20412036
...
20422037
fun:ldap_int_tls_start
20432038
fun:ldap_start_tls_s
@@ -2076,12 +2071,10 @@
20762071
match-leak-kinds: reachable
20772072
fun:malloc
20782073
fun:PORT_Alloc_Util
2079-
obj:/usr/lib64/libnss3.so
2080-
obj:/usr/lib64/libnss3.so
2074+
...
20812075
fun:SECMOD_LoadModule
20822076
...
20832077
fun:ldap_int_tls_start
2084-
fun:ldap_start_tls_s
20852078
...
20862079
}
20872080

@@ -2138,13 +2131,7 @@
21382131
fun:calloc
21392132
fun:PR_LoadLibraryWithFlags
21402133
...
2141-
obj:/usr/lib64/libnss3.so
2142-
...
21432134
fun:tlsmc_open_nssdb
2144-
fun:tlsmc_convert
2145-
fun:tlsmc_intercept_initialization
2146-
obj:/usr/lib64/libldap-2.4.so.2.10.7
2147-
...
21482135
}
21492136

21502137
{
@@ -2197,16 +2184,10 @@
21972184
Memcheck:Leak
21982185
match-leak-kinds: reachable
21992186
fun:calloc
2200-
fun:NSSRWLock_New_Util
2201-
fun:SECOID_Init
22022187
...
22032188
fun:dl_open_worker
2204-
fun:_dl_catch_error
2205-
fun:_dl_open
2206-
...
2207-
fun:PR_LoadLibraryWithFlags
2208-
obj:/usr/lib64/libnssutil3.so
22092189
...
2190+
fun:_dl_open
22102191
}
22112192

22122193
{
@@ -2231,12 +2212,6 @@
22312212
match-leak-kinds: reachable
22322213
fun:calloc
22332214
fun:PORT_ZAlloc_Util
2234-
obj:/usr/lib64/libfreeblpriv3.so
2235-
...
2236-
fun:_dlerror_run
2237-
fun:dlopen@@GLIBC_2.2.5
2238-
fun:PR_LoadLibraryWithFlags
2239-
...
22402215
}
22412216

22422217
{
@@ -2290,8 +2265,6 @@
22902265
fun:PORT_ArenaAlloc_Util
22912266
...
22922267
fun:ldap_int_tls_start
2293-
fun:ldap_start_tls_s
2294-
...
22952268
}
22962269

22972270
{
@@ -2319,11 +2292,8 @@
23192292
fun:PR_NewLock
23202293
...
23212294
fun:SECMOD_LoadModule
2322-
obj:/usr/lib64/libnss3.so
23232295
...
23242296
fun:ldap_int_tls_start
2325-
fun:ldap_start_tls_s
2326-
...
23272297
}
23282298

23292299
{
@@ -2370,8 +2340,6 @@
23702340
fun:SECMOD_LoadModule
23712341
...
23722342
fun:ldap_int_tls_start
2373-
fun:ldap_start_tls_s
2374-
...
23752343
}
23762344

23772345
{
@@ -2429,8 +2397,6 @@
24292397
...
24302398
fun:tlsmc_convert
24312399
fun:tlsmc_intercept_initialization
2432-
obj:/usr/lib64/libldap-2.4.so.2.10.7
2433-
...
24342400
}
24352401

24362402
{

sql/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2020, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0,
@@ -1035,6 +1035,21 @@ TARGET_LINK_LIBRARIES(mysqld
10351035
sql_main sql_gis binlog rpl master slave sql_dd mysys
10361036
minchassis binlogevents_static ${ICU_LIBRARIES})
10371037

1038+
# Add dependency on ldap library, to ensure it is not unloaded
1039+
# when we shutdown the authentication plugin.
1040+
# For Valgrind, we need it to enable our suppressions.
1041+
# For OpenSSL in the 1.0.x series, we need it for clean shutdown.
1042+
IF(WITH_VALGRIND)
1043+
SET(LINK_MYSQLD_LDAP_LIBRARY 1)
1044+
ENDIF()
1045+
IF(WITH_SSL STREQUAL "system" AND
1046+
"${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}" VERSION_LESS "1.1")
1047+
SET(LINK_MYSQLD_LDAP_LIBRARY 1)
1048+
ENDIF()
1049+
IF(WITH_AUTHENTICATION_LDAP AND LINK_MYSQLD_LDAP_LIBRARY)
1050+
TARGET_LINK_LIBRARIES(mysqld ${LDAP_LIBRARY})
1051+
ENDIF()
1052+
10381053
# Remove transitive link dependencies when linking plugins
10391054
SET_TARGET_PROPERTIES(mysqld PROPERTIES INTERFACE_LINK_LIBRARIES "")
10401055

0 commit comments

Comments
 (0)