[MDEV-14229] Stack trace is not resolved for shared objects Created: 2017-10-31  Updated: 2022-09-19  Resolved: 2018-01-19

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: 5.5.59, 10.0.34, 10.0.34-galera, 10.1.31, 10.2.13, 10.3.5, 10.4.0, 10.5.0

Type: Bug Priority: Major
Reporter: Sergey Vojtovich Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-25198 mariadb backup fails with signal 6 an... Closed
Relates
relates to MDEV-16194 Stack trace is not resolved on fulltest2 Open
relates to MDEV-23186 mysqld doesn't create core dump if cr... Closed
Sprint: 10.1.29, 10.1.30, 5.5.59

 Description   

In the following example (which is quite common) only mysqld frames were resolved properly. Frames from shared objects are not resolved.

This is because addr2line attempts to resolve shared object frames while it is being called against mysqld binary.

To resolve shared object frames addr2line should be called individually for these objects.

mysys/stacktrace.c:269(my_print_stacktrace)[0x56491efeceff]
sql/signal_handler.cc:168(handle_fatal_signal)[0x56491e8126b5]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fcaf2825390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7fcaf1bde428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7fcaf1be002a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x7fcaf1bd6bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7fcaf1bd6c82]
/home/svoj/devel/maria/debug/mysql-test/var/plugins/proc_info.so(+0xd1f)[0x7fcaec38ad1f]
sql/sql_show.cc:8350(get_schema_tables_result(JOIN*, enum_schema_table_state))[0x56491e600e92]
sql/sql_select.cc:3511(JOIN::exec_inner())[0x56491e59ce16]
sql/sql_select.cc:3344(JOIN::exec())[0x56491e59c4bc]
sql/sql_select.cc:3745(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x56491e59d694]
sql/sql_select.cc:378(handle_select(THD*, LEX*, select_result*, unsigned long))[0x56491e591c08]
sql/sql_parse.cc:6467(execute_sqlcom_select(THD*, TABLE_LIST*))[0x56491e55cf79]
sql/sql_parse.cc:3731(mysql_execute_command(THD*))[0x56491e55312c]
sql/sql_parse.cc:7921(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x56491e5608a8]
sql/sql_parse.cc:1821(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x56491e54db6b]
sql/sql_parse.cc:1370(do_command(THD*))[0x56491e54c51a]
sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*))[0x56491e6a325a]
sql/sql_connect.cc:1325(handle_one_connection)[0x56491e6a2fad]
perfschema/pfs.cc:1864(pfs_spawn_thread)[0x56491ea46791]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fcaf281b6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fcaf1cb03dd]



 Comments   
Comment by Vicențiu Ciorbaru [ 2018-01-16 ]

Hi Sergey!

Can you please review the patch for this issue? The code is at:
http://lists.askmonty.org/pipermail/commits/2018-January/011826.html

The main worry I have is with the LIBDL change in mysys/CMakeLists.txt and if we need any checks for the extra used functions.

The rest is tested and produces the following output, with a purposefully introduced NULL pointer dereference:

Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x48000
mysys/stacktrace.c:246(my_print_stacktrace)[0x55d6b69c1ba4]
sql/signal_handler.cc:155(handle_fatal_signal)[0x55d6b6484763]
sigaction.c:0(__restore_rt)[0x7efcd9187da0]
dict/dict0boot.c:456(dict_boot)[0x7efcd1759a34]
dict/dict0boot.c:489(dict_create)[0x7efcd1759ac5]
srv/srv0start.c:1681(innobase_start_or_create_for_mysql)[0x7efcd1893dcf]
handler/ha_innodb.cc:2611(innobase_init(void*))[0x7efcd1814577]
sql/handler.cc:470(ha_initialize_handlerton(st_plugin_int*))[0x55d6b6486632]
sql/sql_plugin.cc:1376(plugin_initialize(st_mem_root*, st_plugin_int*, int*, char**, bool))[0x55d6b62ce4bd]
sql/sql_plugin.cc:1650(plugin_init(int*, char**, int))[0x55d6b62cefb3]
sql/mysqld.cc:4294(init_server_components())[0x55d6b6205e58]
sql/mysqld.cc:4891(mysqld_main(int, char**))[0x55d6b6206f21]
sql/main.cc:26(main)[0x55d6b61fee0a]
/usr/lib/libc.so.6(__libc_start_main+0xea)[0x7efcd781ff4a]
/home/vicentiu/Workspace/MariaDB-5.5/sql/mysqld(_start+0x2a)[0x55d6b61fed0a]

Generated at Thu Feb 08 08:11:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.