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

ASAN memcpy-param-overlap in fill_alter_inplace_info upon adding indexes

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (f1 INT, f2 INT, f3 INT) ENGINE=HEAP;
      ALTER TABLE t1 ADD FOREIGN KEY f (f2) REFERENCES xx(f2);
      ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1(f2), ADD KEY (f3), ADD KEY (f1);
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 d2013e73

      ==21073==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x62b000064178,0x62b000064180) and [0x62b00006417c, 0x62b000064184) overlap
          #0 0x7f638cd9891f (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x2e91f)
          #1 0x556fec1aa9d8 in fill_alter_inplace_info /data/src/10.4/sql/sql_table.cc:7067
          #2 0x556fec1bbad6 in mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) /data/src/10.4/sql/sql_table.cc:9872
          #3 0x556fec317c3a in Sql_cmd_alter_table::execute(THD*) /data/src/10.4/sql/sql_alter.cc:496
          #4 0x556febf9062f in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:6344
          #5 0x556febf9adc3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:8154
          #6 0x556febf7322c in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1832
          #7 0x556febf70071 in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1365
          #8 0x556fec30260d in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1398
          #9 0x556fec302006 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1301
          #10 0x556fecec89fc in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #11 0x7f638cb54493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
          #12 0x7f638ad2293e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
       
      0x62b000064178 is located 8056 bytes inside of 24716-byte region [0x62b000062200,0x62b00006828c)
      allocated by thread T5 here:
          #0 0x7f638cdbe73f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x556fed87c965 in sf_malloc /data/src/10.4/mysys/safemalloc.c:118
          #2 0x556fed84d260 in my_malloc /data/src/10.4/mysys/my_malloc.c:101
          #3 0x556fed82bd66 in reset_root_defaults /data/src/10.4/mysys/my_alloc.c:151
          #4 0x556febe712d5 in THD::init_for_queries() /data/src/10.4/sql/sql_class.cc:1375
          #5 0x556fec3019ba in prepare_new_connection_state(THD*) /data/src/10.4/sql/sql_connect.cc:1232
          #6 0x556fec30204c in thd_prepare_connection(THD*) /data/src/10.4/sql/sql_connect.cc:1316
          #7 0x556fec3025da in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1386
          #8 0x556fec302006 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1301
          #9 0x556fecec89fc in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #10 0x7f638cb54493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
       
      Thread T5 created by T0 here:
          #0 0x7f638cd8dbba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
          #1 0x556fecec8fc4 in spawn_thread_v1 /data/src/10.4/storage/perfschema/pfs.cc:1912
          #2 0x556febcc0856 in inline_mysql_thread_create /data/src/10.4/include/mysql/psi/mysql_thread.h:1268
          #3 0x556febcd57a1 in create_thread_to_handle_connection(CONNECT*) /data/src/10.4/sql/mysqld.cc:6218
          #4 0x556febcd5ea6 in create_new_thread(CONNECT*) /data/src/10.4/sql/mysqld.cc:6288
          #5 0x556febcd6236 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.4/sql/mysqld.cc:6386
          #6 0x556febcd6e82 in handle_connections_sockets() /data/src/10.4/sql/mysqld.cc:6544
          #7 0x556febcd4fdc in mysqld_main(int, char**) /data/src/10.4/sql/mysqld.cc:5876
          #8 0x556febcbe6df in main /data/src/10.4/sql/main.cc:25
          #9 0x7f638ac5a2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
       
      0x62b00006417c is located 8060 bytes inside of 24716-byte region [0x62b000062200,0x62b00006828c)
      allocated by thread T5 here:
          #0 0x7f638cdbe73f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x556fed87c965 in sf_malloc /data/src/10.4/mysys/safemalloc.c:118
          #2 0x556fed84d260 in my_malloc /data/src/10.4/mysys/my_malloc.c:101
          #3 0x556fed82bd66 in reset_root_defaults /data/src/10.4/mysys/my_alloc.c:151
          #4 0x556febe712d5 in THD::init_for_queries() /data/src/10.4/sql/sql_class.cc:1375
          #5 0x556fec3019ba in prepare_new_connection_state(THD*) /data/src/10.4/sql/sql_connect.cc:1232
          #6 0x556fec30204c in thd_prepare_connection(THD*) /data/src/10.4/sql/sql_connect.cc:1316
          #7 0x556fec3025da in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1386
          #8 0x556fec302006 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1301
          #9 0x556fecec89fc in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #10 0x7f638cb54493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
       
      SUMMARY: AddressSanitizer: memcpy-param-overlap ??:0 ??
      ==21073==ABORTING
      

      The failure appeared after this commit:

      commit 3a3d5ba2356b85626d34d6a65e4d8e8e6205b60d 5d8ca989974734e931cf247434e9f96297e4af4d
      Author: Eugene Kosov
      Date:   Thu Mar 14 17:28:20 2019 +0300
       
          MDEV-13301 Optimize DROP INDEX, ADD INDEX into RENAME INDEX
      

      No obvious problem on a non-ASAN build.

      Attachments

        Issue Links

          Activity

            People

              kevg Eugene Kosov (Inactive)
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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