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

SIGSEGV in replace_column_table on GRANT

    XMLWordPrintable

Details

    Description

      Whilst present in all versions, this may be a new regression. Testcase may be lightly sporadic.

      SET sql_mode='';
      RENAME TABLE mysql.columns_priv TO mysql.columns_priv_bak;
      CREATE TABLE mysql.columns_priv SELECT * FROM mysql.columns_priv_bak;  # "LIKE" instead of "SELECT * FROM" does not lead to a crash, and neither does ALTER TABLE mysql.columns_priv ENGINE=InnoDB instead of the first two commands. There are 0 rows in the table.
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      GRANT UPDATE (c) ON t TO a@localhost;
      

      Leads to:

      10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

      Core was generated by `/test/MD160322-mariadb-10.9.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x000056027bced0cb in replace_column_table (g_t=g_t@entry=0x56027edd2788, 
          table=0x14d108097d58, combo=..., columns=..., 
          db=db@entry=0x14d1080146e8 "test", 
          table_name=table_name@entry=0x14d108013f60 "t", rights=NO_ACL, 
          revoke_grant=false) at /test/10.9_dbg/sql/sql_acl.cc:5570
      5570	  KEY_PART_INFO *key_part= table->key_info->key_part;
      [Current thread is 1 (Thread 0x14d17c0bd700 (LWP 31918))]
      (gdb) bt
      #0  0x000056027bced0cb in replace_column_table (g_t=g_t@entry=0x56027edd2788, table=0x14d108097d58, combo=@0x14d108013fc8: {<AUTHID> = {user = {str = 0x14d108013fb0 "a", length = 1}, host = {str = 0x14d108013fb8 "localhost", length = 9}}, auth = 0x56027d406960 <auth_no_password>}, columns=@0x14d108014700: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d108013f50, last = 0x14d108013f50, elements = 1}, <No data fields>}, db=db@entry=0x14d1080146e8 "test", table_name=table_name@entry=0x14d108013f60 "t", rights=NO_ACL, revoke_grant=false) at /test/10.9_dbg/sql/sql_acl.cc:5570
      #1  0x000056027bd07cfc in mysql_table_grant (thd=thd@entry=0x14d108000db8, table_list=0x14d108014008, user_list=@0x14d108006060: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d108013ff0, last = 0x14d108013ff0, elements = 1}, <No data fields>}, columns=@0x14d108014700: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d108013f50, last = 0x14d108013f50, elements = 1}, <No data fields>}, rights=NO_ACL, revoke_grant=false) at /test/10.9_dbg/sql/sql_acl.cc:7191
      #2  0x000056027bd08120 in Sql_cmd_grant_table::execute_exact_table (this=0x14d1080146f0, thd=0x14d108000db8, table=<optimized out>) at /test/10.9_dbg/sql/sql_acl.h:317
      #3  0x000056027bd0bece in Sql_cmd_grant_table::execute (this=<optimized out>, thd=<optimized out>) at /test/10.9_dbg/sql/sql_acl.cc:12184
      #4  0x000056027bdba930 in mysql_execute_command (thd=thd@entry=0x14d108000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:5988
      #5  0x000056027bda1437 in mysql_parse (thd=thd@entry=0x14d108000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d17c0bc400) at /test/10.9_dbg/sql/sql_parse.cc:8027
      #6  0x000056027bdb00d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d108000db8, packet=packet@entry=0x14d10800b889 "GRANT UPDATE (c) ON t TO a@localhost", packet_length=packet_length@entry=36, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
      #7  0x000056027bdb351a in do_command (thd=0x14d108000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
      #8  0x000056027bf2e228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56027edc12b8, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
      #9  0x000056027bf2e82d in handle_one_connection (arg=arg@entry=0x56027edc12b8) at /test/10.9_dbg/sql/sql_connect.cc:1312
      #10 0x000056027c3b4f23 in pfs_spawn_thread (arg=0x56027ecd4848) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
      #11 0x000014d18842e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #12 0x000014d18801a163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Optimized)

      Core was generated by `/test/MD160322-mariadb-10.9.0-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x000055e09a33c147 in replace_column_table (g_t=0x55e09de1a038, 
          table=0x151dd40580f8, combo=..., columns=..., db=0x151dd40111c8 "test", 
          table_name=0x151dd4010a40 "t", rights=NO_ACL, revoke_grant=false)
          at /test/10.9_opt/sql/sql_acl.cc:5570
      5570	  KEY_PART_INFO *key_part= table->key_info->key_part;
      [Current thread is 1 (Thread 0x151e3c13d700 (LWP 31916))]
      (gdb) bt
      #0  0x000055e09a33c147 in replace_column_table (g_t=0x55e09de1a038, table=0x151dd40580f8, combo=@0x151dd4010aa8: {<AUTHID> = {user = {str = 0x151dd4010a90 "a", length = 1}, host = {str = 0x151dd4010a98 "localhost", length = 9}}, auth = 0x55e09b56e480 <auth_no_password>}, columns=@0x151dd40111e0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x151dd4010a30, last = 0x151dd4010a30, elements = 1}, <No data fields>}, db=0x151dd40111c8 "test", table_name=0x151dd4010a40 "t", rights=NO_ACL, revoke_grant=false) at /test/10.9_opt/sql/sql_acl.cc:5570
      #1  0x000055e09a355675 in mysql_table_grant (thd=0x151dd4000c58, table_list=0x151dd4010ae8, user_list=<optimized out>, columns=@0x151dd40111e0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x151dd4010a30, last = 0x151dd4010a30, elements = 1}, <No data fields>}, rights=NO_ACL, revoke_grant=false) at /test/10.9_opt/sql/sql_acl.cc:7191
      #2  0x000055e09a359dd4 in Sql_cmd_grant_table::execute_exact_table (this=0x151dd40111d0, thd=0x151dd4000c58, table=<optimized out>) at /test/10.9_opt/sql/sql_acl.h:317
      #3  0x000055e09a3de2f6 in mysql_execute_command (thd=0x151dd4000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.9_opt/sql/sql_parse.cc:5988
      #4  0x000055e09a3ce1c6 in mysql_parse (thd=0x151dd4000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.9_opt/sql/sql_parse.cc:8027
      #5  0x000055e09a3da375 in dispatch_command (command=COM_QUERY, thd=0x151dd4000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.9_opt/sql/sql_class.h:1362
      #6  0x000055e09a3dc567 in do_command (thd=0x151dd4000c58, blocking=blocking@entry=true) at /test/10.9_opt/sql/sql_parse.cc:1402
      #7  0x000055e09a4fbe97 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.9_opt/sql/sql_connect.cc:1418
      #8  0x000055e09a4fc1dd in handle_one_connection (arg=arg@entry=0x55e09de2e888) at /test/10.9_opt/sql/sql_connect.cc:1312
      #9  0x000055e09a8758d1 in pfs_spawn_thread (arg=0x55e09ddc3a48) at /test/10.9_opt/storage/perfschema/pfs.cc:2201
      #10 0x0000151e47674609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #11 0x0000151e47260163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.4.25 9c6135e81f29b3e3286d6b864c0fdafc2fea16ce (Debug)

      Core was generated by `/test/MD160322-mariadb-10.4.25-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000555daef61641 in replace_column_table (g_t=g_t@entry=0x555db20f99f8, 
          table=0x154a0408a910, combo=..., columns=..., 
          db=db@entry=0x154a04013a40 "test", 
          table_name=table_name@entry=0x154a04013340 "t", rights=0, 
          revoke_grant=false) at /test/10.4_dbg/sql/sql_acl.cc:5420
      [Current thread is 1 (Thread 0x154a580a2700 (LWP 32171))]
      (gdb) bt
      #0  0x0000555daef61641 in replace_column_table (g_t=g_t@entry=0x555db20f99f8, table=0x154a0408a910, combo=@0x154a04013a60: {<AUTHID> = {user = {str = 0x154a04013a48 "a", length = 1}, host = {str = 0x154a04013a50 "localhost", length = 9}}, auth = 0x555db05ece80 <auth_no_password>}, columns=@0x154a04005b80: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x154a04013330, last = 0x154a04013330, elements = 1}, <No data fields>}, db=db@entry=0x154a04013a40 "test", table_name=table_name@entry=0x154a04013340 "t", rights=0, revoke_grant=false) at /test/10.4_dbg/sql/sql_acl.cc:5420
      #1  0x0000555daef7d3e6 in mysql_table_grant (thd=thd@entry=0x154a04000d90, table_list=0x154a04013378, user_list=@0x154a04005b68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x154a04013a88, last = 0x154a04013a88, elements = 1}, <No data fields>}, columns=@0x154a04005b80: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x154a04013330, last = 0x154a04013330, elements = 1}, <No data fields>}, rights=0, revoke_grant=false) at /test/10.4_dbg/sql/sql_acl.cc:7039
      #2  0x0000555daf01da1b in mysql_execute_command (thd=thd@entry=0x154a04000d90) at /test/10.4_dbg/sql/sql_parse.cc:5423
      #3  0x0000555daf022d01 in mysql_parse (thd=thd@entry=0x154a04000d90, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x154a580a1490, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7995
      #4  0x0000555daf02575d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x154a04000d90, packet=packet@entry=0x154a0401a361 "GRANT UPDATE (c) ON t TO a@localhost", packet_length=packet_length@entry=36, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_class.h:1201
      #5  0x0000555daf029050 in do_command (thd=0x154a04000d90) at /test/10.4_dbg/sql/sql_parse.cc:1373
      #6  0x0000555daf168457 in do_handle_one_connection (connect=connect@entry=0x555db2110150) at /test/10.4_dbg/sql/sql_connect.cc:1420
      #7  0x0000555daf168576 in handle_one_connection (arg=0x555db2110150) at /test/10.4_dbg/sql/sql_connect.cc:1316
      #8  0x0000154a6e257609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #9  0x0000154a6de43163 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 (dbg), 10.3.35 (opt), 10.4.25 (dbg), 10.4.25 (opt), 10.5.16 (dbg), 10.5.16 (opt), 10.6.8 (dbg), 10.6.8 (opt), 10.7.4 (dbg), 10.7.4 (opt), 10.8.3 (dbg), 10.8.3 (opt), 10.9.0 (dbg), 10.9.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.