[MDEV-23299] The udf_init() function cause server crash. Created: 2020-07-27  Updated: 2023-08-03  Resolved: 2023-08-03

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.5.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: jingbo zhao Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: UDF, crash


 Description   

When insert into a null name to mysql.func, restart the server will crash.

For example:

MariaDB [(none)]> select * from mysql.func;
Empty set (0.001 sec)
 
MariaDB [(none)]> insert into mysql.func(ret) values(1);
Query OK, 1 row affected (0.001 sec)
 
MariaDB [(none)]> select * from mysql.func;
+------+-----+----+----------+
| name | ret | dl | type     |
+------+-----+----+----------+
|      |   1 |    | function |
+------+-----+----+----------+
1 row in set (0.001 sec) 

Restart the MariaDB Server, the server crash.

The error stack is:

Thread pointer: 0x5557ed51dad8
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 = 0x7ffd6e777958 thread_stack 0x49000
/data/server/build/sql/mariadbd(my_print_stacktrace+0x2e)[0x5557eb49f97e]
mysys/stacktrace.c:307(my_print_stacktrace)[0x5557eaf20daf]
sigaction.c:0(__restore_rt)[0x7f3eac7bf5f0]
:0(__strlen_sse2_pminub)[0x7f3eaae0a641]
sql/sql_udf.cc:209(udf_init())[0x5557eadd01d6]
sql/mysqld.cc:5533(mysqld_main(int, char**))[0x5557eac7a564]
??:0(__libc_start_main)[0x7f3eaacbd505]
/data/server/build/sql/mariadbd(+0x682973)[0x5557eac6e973]
 
the gdb core stack is:
 
#0  0x00007f3c8ba68a61 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000563837533557 in my_write_core (sig=<optimized out>) at /data/server/mysys/stacktrace.c:518
#2  0x0000563836fb4e1e in handle_fatal_signal (sig=11) at /data/server/sql/signal_handler.cc:330
#3  <signal handler called>
#4  0x00007f3c8a0b6641 in __strlen_sse2_pminub () from /lib64/libc.so.6
#5  0x0000563836e6418f in udf_init () at /data/server/sql/sql_udf.cc:209
#6  0x0000563836d0e564 in mysqld_main (argc=27, argv=0x563839740890) at /data/server/sql/mysqld.cc:5531
#7  0x00007f3c89f69505 in __libc_start_main () from /lib64/libc.so.6
#8  0x0000563836d02973 in _start ()

I have fixed this bug.



 Comments   
Comment by jingbo zhao [ 2020-07-27 ]

The pull requests is : https://github.com/MariaDB/server/pull/1643

Comment by Andrew Hutchings [ 2023-08-03 ]

I'm not sure what version it was released in, but this was fixed in commit 4f63b6cf53ce2d9eaf4a8006587ebf3c4d6ddd3c in 2021.

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