Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-28773

SIGSEGV in TABLE::use_all_columns, replace_roles_mapping_table, UBSAN runtime error: member call on null pointer in replace_roles_mapping_table and other functions

Details

    Description

      DROP TABLE IF EXISTS mysql.roles_mapping;
      CREATE ROLE r1;
      

      Leads to:

      10.10.0 d7a7d16713070c7c2902c3df4b4f6d024cd0320f (Optimized)

      Core was generated by `/test/mtest/GAL_MD080622-mariadb-10.10.0-linux-x86_64-opt/bin/mysqld --defaults'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x146cba28a700 (LWP 2230243))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x000056091dc5319f in my_write_core (sig=sig@entry=11) at /test/mtest/10.10_opt/mysys/stacktrace.c:424
      #2  0x000056091d7a2170 in handle_fatal_signal (sig=11) at /test/mtest/10.10_opt/sql/signal_handler.cc:345
      #3  <signal handler called>
      #4  TABLE::use_all_columns (this=0x0) at /test/mtest/10.10_opt/sql/table.h:1620
      #5  replace_roles_mapping_table (table=0x0, user=0x146c800107d8, host=0x146c800107e8, role=role@entry=0x146c800107a0, with_admin=with_admin@entry=true, existing=existing@entry=0x0, revoke_grant=false) at /test/mtest/10.10_opt/sql/sql_acl.cc:4953
      #6  0x000056091d4d68c5 in mysql_create_user (thd=thd@entry=0x146c80000c58, list=@0x146c80005b50: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146c800107c8, last = 0x146c800107c8, elements = 1}, <No data fields>}, handle_as_role=true) at /test/mtest/10.10_opt/sql/sql_acl.cc:10936
      #7  0x000056091d567046 in mysql_execute_command (thd=0x146c80000c58, is_called_from_prepared_stmt=<optimized out>) at /test/mtest/10.10_opt/sql/sql_parse.cc:5328
      #8  0x000056091d557036 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x146c80000c58) at /test/mtest/10.10_opt/sql/sql_parse.cc:8036
      #9  mysql_parse (thd=0x146c80000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/mtest/10.10_opt/sql/sql_parse.cc:7958
      #10 0x000056091d5568c1 in wsrep_mysql_parse (thd=0x146c80000c58, rawbuf=0x146c80010720 "CREATE ROLE r1", length=14, parser_state=0x146cba289470) at /test/mtest/10.10_opt/sql/sql_parse.cc:7849
      #11 0x000056091d563da5 in dispatch_command (command=COM_QUERY, thd=0x146c80000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/mtest/10.10_opt/sql/sql_parse.cc:1977
      #12 0x000056091d564b18 in do_command (thd=0x146c80000c58, blocking=blocking@entry=true) at /test/mtest/10.10_opt/sql/sql_parse.cc:1407
      #13 0x000056091d67c5c7 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56091f53d598, put_in_cache=put_in_cache@entry=true) at /test/mtest/10.10_opt/sql/sql_connect.cc:1418
      #14 0x000056091d67c8ad in handle_one_connection (arg=0x56091f53d598) at /test/mtest/10.10_opt/sql/sql_connect.cc:1312
      #15 0x0000146cf0348609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #16 0x0000146ceff36293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (opt), 10.3.36 (dbg), 10.4.25 (opt), 10.4.26 (dbg), 10.5.16 (opt), 10.5.17 (dbg), 10.6.8 (opt), 10.6.9 (dbg), 10.7.4 (opt), 10.7.5 (dbg), 10.8.4 (dbg), 10.8.3 (opt), 10.9.2 (opt), 10.9.2 (dbg), 10.10.0 (opt), 10.10.0 (dbg)

      Attachments

        Issue Links

          Activity

            UBSAN Also sees this as:

            11.4.2 9b6e267bfd8fbed66807b8ca81a84d1faa84ff34 (Optimized, UBASAN)

            /test/11.4_opt_san/sql/sql_acl.cc:5117:25: runtime error: member call on null pointer of type 'struct TABLE'
                #0 0x560e1fe2f107 in replace_roles_mapping_table /test/11.4_opt_san/sql/sql_acl.cc:5117
                #1 0x560e1fead117 in mysql_create_user(THD*, List<LEX_USER>&, bool) /test/11.4_opt_san/sql/sql_acl.cc:11165
                #2 0x560e203744b9 in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:5135
                #3 0x560e2038fba2 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7815
                #4 0x560e2039bbbb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1893
                #5 0x560e203a7608 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1406
                #6 0x560e20cfecbc in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1437
                #7 0x560e20d012bc in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1339
                #8 0x153c48894ac2 in start_thread nptl/pthread_create.c:442
                #9 0x153c4892684f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
             
            /test/11.4_opt_san/sql/table.h:1658:23: runtime error: member call on null pointer of type 'struct TABLE'
                #0 0x560e1fe2f115 in TABLE::use_all_columns() /test/11.4_opt_san/sql/table.h:1658
                #1 0x560e1fe2f115 in replace_roles_mapping_table /test/11.4_opt_san/sql/sql_acl.cc:5117
                #2 0x560e1fead117 in mysql_create_user(THD*, List<LEX_USER>&, bool) /test/11.4_opt_san/sql/sql_acl.cc:11165
                #3 0x560e203744b9 in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:5135
                #4 0x560e2038fba2 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7815
                #5 0x560e2039bbbb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1893
                #6 0x560e203a7608 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1406
                #7 0x560e20cfecbc in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1437
                #8 0x560e20d012bc in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1339
                #9 0x153c48894ac2 in start_thread nptl/pthread_create.c:442
                #10 0x153c4892684f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
             
            /test/11.4_opt_san/sql/table.h:1658:38: runtime error: member access within null pointer of type 'struct TABLE'
                #0 0x560e1fe2f123 in TABLE::use_all_columns() /test/11.4_opt_san/sql/table.h:1658
                #1 0x560e1fe2f123 in replace_roles_mapping_table /test/11.4_opt_san/sql/sql_acl.cc:5117
                #2 0x560e1fead117 in mysql_create_user(THD*, List<LEX_USER>&, bool) /test/11.4_opt_san/sql/sql_acl.cc:11165
                #3 0x560e203744b9 in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:5135
                #4 0x560e2038fba2 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7815
                #5 0x560e2039bbbb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1893
                #6 0x560e203a7608 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1406
                #7 0x560e20cfecbc in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1437
                #8 0x560e20d012bc in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1339
                #9 0x153c48894ac2 in start_thread nptl/pthread_create.c:442
                #10 0x153c4892684f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
             
            240227 13:12:37 [ERROR] mysqld got signal 11 ;
            

            Roel Roel Van de Paar added a comment - UBSAN Also sees this as: 11.4.2 9b6e267bfd8fbed66807b8ca81a84d1faa84ff34 (Optimized, UBASAN) /test/11.4_opt_san/sql/sql_acl.cc:5117:25: runtime error: member call on null pointer of type 'struct TABLE' #0 0x560e1fe2f107 in replace_roles_mapping_table /test/11.4_opt_san/sql/sql_acl.cc:5117 #1 0x560e1fead117 in mysql_create_user(THD*, List<LEX_USER>&, bool) /test/11.4_opt_san/sql/sql_acl.cc:11165 #2 0x560e203744b9 in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:5135 #3 0x560e2038fba2 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7815 #4 0x560e2039bbbb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1893 #5 0x560e203a7608 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1406 #6 0x560e20cfecbc in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1437 #7 0x560e20d012bc in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1339 #8 0x153c48894ac2 in start_thread nptl/pthread_create.c:442 #9 0x153c4892684f (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)   /test/11.4_opt_san/sql/table.h:1658:23: runtime error: member call on null pointer of type 'struct TABLE' #0 0x560e1fe2f115 in TABLE::use_all_columns() /test/11.4_opt_san/sql/table.h:1658 #1 0x560e1fe2f115 in replace_roles_mapping_table /test/11.4_opt_san/sql/sql_acl.cc:5117 #2 0x560e1fead117 in mysql_create_user(THD*, List<LEX_USER>&, bool) /test/11.4_opt_san/sql/sql_acl.cc:11165 #3 0x560e203744b9 in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:5135 #4 0x560e2038fba2 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7815 #5 0x560e2039bbbb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1893 #6 0x560e203a7608 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1406 #7 0x560e20cfecbc in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1437 #8 0x560e20d012bc in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1339 #9 0x153c48894ac2 in start_thread nptl/pthread_create.c:442 #10 0x153c4892684f (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)   /test/11.4_opt_san/sql/table.h:1658:38: runtime error: member access within null pointer of type 'struct TABLE' #0 0x560e1fe2f123 in TABLE::use_all_columns() /test/11.4_opt_san/sql/table.h:1658 #1 0x560e1fe2f123 in replace_roles_mapping_table /test/11.4_opt_san/sql/sql_acl.cc:5117 #2 0x560e1fead117 in mysql_create_user(THD*, List<LEX_USER>&, bool) /test/11.4_opt_san/sql/sql_acl.cc:11165 #3 0x560e203744b9 in mysql_execute_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:5135 #4 0x560e2038fba2 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /test/11.4_opt_san/sql/sql_parse.cc:7815 #5 0x560e2039bbbb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /test/11.4_opt_san/sql/sql_parse.cc:1893 #6 0x560e203a7608 in do_command(THD*, bool) /test/11.4_opt_san/sql/sql_parse.cc:1406 #7 0x560e20cfecbc in do_handle_one_connection(CONNECT*, bool) /test/11.4_opt_san/sql/sql_connect.cc:1437 #8 0x560e20d012bc in handle_one_connection /test/11.4_opt_san/sql/sql_connect.cc:1339 #9 0x153c48894ac2 in start_thread nptl/pthread_create.c:442 #10 0x153c4892684f (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)   240227 13:12:37 [ERROR] mysqld got signal 11 ;

            People

              serg Sergei Golubchik
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.