Description:
Running mtr with ASAN build on Gentoo tests may fail since the path to libtirpc is not /lib64/libtirpc.so which is the path mtr uses for preloading the library.
Further more the libasan path in Gentoo may contain also underscores and minus which mtr safe_process does not recognize.
Fails on Gentoo since /lib64/libtirpc.so do not exist
+ERROR: ld.so: object '/lib64/libtirpc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Fails on Gentoo since /usr/lib64/libtirpc.so is a GNU LD script
+ERROR: ld.so: object '/usr/lib64/libtirpc.so' from LD_PRELOAD cannot be preloaded (invalid ELF header): ignored.
Need to preload /lib64/libtirpc.so.3 on gentoo.
When compiling with GNU C++ libasan path also include minus and underscores:
$ less mysql-test/lib/My/SafeProcess/ldd_asan_test_result
linux-vdso.so.1 (0x00007ffeba962000)
libasan.so.4 => /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so.4 (0x00007f3c2e827000)
Tests that been affected in different ways see 'How To Repeat' for example:
$ ./mtr group_replication.gr_clone_integration_clone_not_installed ndb.ndb_config ndb.ndb_basic
How to repeat:
Compile with ASAN on Gentoo (or some other platform there /lib64/libtirpc.so is not a valid path to libtirpc) and run for example the below tests:
Examples when using GNU compiler:
$ ./mtr group_replication.gr_clone_integration_clone_not_installed
[ 21%] group_replication.gr_clone_integration_clone_not_installed w3 [ fail ]
Test ended at 2019-06-26 11:10:01
CURRENT_TEST: group_replication.gr_clone_integration_clone_not_installed
ERROR: ld.so: object '/usr/lib/gcc/x86' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib64/libtirpc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
mysqltest: At line 21: Query 'START GROUP_REPLICATION' failed.
ERROR 2013 (HY000): Lost connection to MySQL server during query
...
ASAN:DEADLYSIGNAL
=================================================================
==11970==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f0e5cecfb8c bp 0x7f0e340f1650 sp 0x7f0e340f0dc8 T44)
==11970==The signal is caused by a READ memory access.
==11970==Hint: address points to the zero page.
#0 0x7f0e5cecfb8b in xdr_uint32_t (/lib64/libc.so.6+0x13cb8b)
#1 0x7f0e5fbe6d43 (/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so.4+0x87d43)
#2 0x7f0e3c675e59 in xdr_node_no plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp_xdr.c:88
#3 0x7f0e3c67744d in xdr_pax_msg_1_6 plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp_xdr.c:852
...
$ ./mtr ndb.ndb_config
--- /.../src/mysql-test/suite/ndb/r/ndb_config.result 2019-06-25 21:19:08.308997942 +0300
+++ /.../bld/mysql-test/var/log/ndb_config.reject 2019-06-26 11:58:11.718512944 +0300
@@ -30,16 +30,22 @@
== 16 == bug44689
192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4 192.168.0.1 192.168.0.1
== 17 == bug49400
+ERROR: ld.so: object '/usr/lib/gcc/x86' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
+ERROR: ld.so: object '/lib64/libtirpc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR -- at line 25: TCP connection is a duplicate of the existing TCP link from line 14
ERROR -- at line 25: Could not store section of configuration file.
If running test that do not record stderr, the pre load failure are no critical but mess up the output of mtr:
$ ./mtr ndb.ndb_basic
[100%] ndb.ndb_basic [ pass ] 34706
ERROR: ld.so: object '/usr/lib/gcc/x86' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/lib64/libtirpc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Suggested fix:
In mysqltest_safe_process use same trick for libtirpc as for libasan to determine path to library for pre loading.
Also allow underscores and minus in paths.