[MDEV-27514] Server crashes upon ENCRYPT() call on ASAN builds with gcc-10 Created: 2022-01-15  Updated: 2022-03-14  Resolved: 2022-03-14

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Elena Stepanova
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

gcc-10, e.g. 10.2.1 on Debian 11, WITH_ASAN



 Description   

The failure happens reliably on ASAN builds (debug and RelWithDebInfo), on different machines, but specifically built with gcc-10; not with gcc-9 or earlier, and not with clang-10/11/12.
I didn't check other compilers.

SELECT ENCRYPT('x');

10.2 746050d0 ASAN build

#3  <signal handler called>
#4  0x0000000000000000 in ?? ()
#5  0x000055a8b3ef5089 in Item_func_encrypt::val_str (this=0x62b0000005d0, str=0x7f9de1a77c90) at /10.2/src/sql/item_strfunc.cc:2230
#6  0x000055a8b3daf3e3 in Item::send (this=0x62b0000005d0, protocol=0x62a00005a828, buffer=0x7f9de1a77c90) at /10.2/src/sql/item.cc:6952
#7  0x000055a8b3544e47 in Protocol::send_result_set_row (this=0x62a00005a828, row_items=0x62a00005e548) at /10.2/src/sql/protocol.cc:993
#8  0x000055a8b369c101 in select_send::send_data (this=0x62b000000798, items=...) at /10.2/src/sql/sql_class.cc:2792
#9  0x000055a8b3802b33 in JOIN::exec_inner (this=0x62b0000007c0) at /10.2/src/sql/sql_select.cc:3527
#10 0x000055a8b38019b3 in JOIN::exec (this=0x62b0000007c0) at /10.2/src/sql/sql_select.cc:3446
#11 0x000055a8b380509c in mysql_select (thd=0x62a00005a270, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000000798, unit=0x62a00005dcd0, select_lex=0x62a00005e420) at /10.2/src/sql/sql_select.cc:3849
#12 0x000055a8b37e1fd6 in handle_select (thd=0x62a00005a270, lex=0x62a00005dc10, result=0x62b000000798, setup_tables_done_option=0) at /10.2/src/sql/sql_select.cc:361
#13 0x000055a8b37601dc in execute_sqlcom_select (thd=0x62a00005a270, all_tables=0x0) at /10.2/src/sql/sql_parse.cc:6271
#14 0x000055a8b374d5da in mysql_execute_command (thd=0x62a00005a270) at /10.2/src/sql/sql_parse.cc:3582
#15 0x000055a8b37690ae in mysql_parse (thd=0x62a00005a270, rawbuf=0x62b000000410 "SELECT ENCRYPT('x')", length=19, parser_state=0x7f9de1a79e00, is_com_multi=false, is_next_command=false) at /10.2/src/sql/sql_parse.cc:7793
#16 0x000055a8b3742d49 in dispatch_command (command=COM_QUERY, thd=0x62a00005a270, packet=0x6290000eb271 "", packet_length=19, is_com_multi=false, is_next_command=false) at /10.2/src/sql/sql_parse.cc:1827
#17 0x000055a8b373fcbe in do_command (thd=0x62a00005a270) at /10.2/src/sql/sql_parse.cc:1381
#18 0x000055a8b3aab1a7 in do_handle_one_connection (connect=0x611000004e30) at /10.2/src/sql/sql_connect.cc:1336
#19 0x000055a8b3aaaaac in handle_one_connection (arg=0x611000004e30) at /10.2/src/sql/sql_connect.cc:1241
#20 0x00007f9de891bea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00007f9de8520def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I'm not sure whether it's a real problem or a bogus error, but it's rather painful for tests, as it prevents from upgrading to newer distribution versions.



 Comments   
Comment by Marko Mäkelä [ 2022-01-15 ]

This looks like a duplicate of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980110 which is not a bug in our code and not even in GCC, but in the Debian packaging of GCC 10. Can you try the test program that I posted in that ticket?

Comment by Elena Stepanova [ 2022-01-15 ]

Thanks.
Yes, your test program fails the way you described.
Sadly the presumably fixed version of gcc is not in Debian repos yet, so I guess we'll just have to wait. It is rather unfortunate.
It is fortunate however that the guilty function apparently isn't widely used in MariaDB code. Is it really just ENCRYPT?

Comment by Elena Stepanova [ 2022-03-14 ]

I assume nothing can be done on our side, so closing

Generated at Thu Feb 08 09:53:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.