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

AddressSanitizer: use-after-poison in Item_change_list::rollback_item_tree_changes

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 ( pk int, v1 varchar(1)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1,'v'),(2,'v'),(3,'c');
       
      CREATE TABLE t2 ( pk int, v1 varchar(1)) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (1,'x');
       
      CREATE TABLE t3 ( pk int, i1 int, v1 varchar(1)) ENGINE=MyISAM;
      INSERT INTO t3 VALUES (10,8,9);
       
      execute immediate 'SELECT STRAIGHT_JOIN 1 FROM (t1 JOIN t2 ON (t1.v1 = t2.v1))
      WHERE (3, 6) IN (SELECT tC.pk,  t3.i1 FROM (t3 JOIN t1 AS tC ON (tC.v1 = t3.v1)) HAVING tC.pk > 1 );';
      

      built as cmake . -DPLUGIN_TOKUDB=NO -DCMAKE_BUILD_TYPE=Debug -DWITH_ASAN=ON :

      10.4 17e371fffe3d0a2593

      ==2451==ERROR: AddressSanitizer: use-after-poison on address 0x62b000082e88 at pc 0x55c8f38b19d5 bp 0x7fb0a6f24090 sp 0x7fb0a6f24080
      WRITE of size 8 at 0x62b000082e88 thread T27
          #0 0x55c8f38b19d4 in Item_change_list::rollback_item_tree_changes() /git/10.4/sql/sql_class.cc:2824
          #1 0x55c8f39fb580 in Prepared_statement::cleanup_stmt() /git/10.4/sql/sql_prepare.cc:3854
          #2 0x55c8f3a02360 in Prepared_statement::execute(String*, bool) /git/10.4/sql/sql_prepare.cc:4818
          #3 0x55c8f39fd82a in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /git/10.4/sql/sql_prepare.cc:4218
          #4 0x55c8f3a03014 in Prepared_statement::execute_immediate(char const*, unsigned int) /git/10.4/sql/sql_prepare.cc:4914
          #5 0x55c8f39f5c1f in mysql_sql_stmt_execute_immediate(THD*) /git/10.4/sql/sql_prepare.cc:2894
          #6 0x55c8f39a1b50 in mysql_execute_command(THD*) /git/10.4/sql/sql_parse.cc:3780
          #7 0x55c8f39bb97e in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /git/10.4/sql/sql_parse.cc:8092
          #8 0x55c8f399682a in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /git/10.4/sql/sql_parse.cc:1851
          #9 0x55c8f39939c2 in do_command(THD*) /git/10.4/sql/sql_parse.cc:1396
          #10 0x55c8f3ceb128 in do_handle_one_connection(CONNECT*) /git/10.4/sql/sql_connect.cc:1402
          #11 0x55c8f3ceab05 in handle_one_connection /git/10.4/sql/sql_connect.cc:1308
          #12 0x55c8f5029ca5 in pfs_spawn_thread /git/10.4/storage/perfschema/pfs.cc:1862
          #13 0x7fb0be4726b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
          #14 0x7fb0bd90741c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
       
      0x62b000082e88 is located 19592 bytes inside of 24716-byte region [0x62b00007e200,0x62b00008428c)
      allocated by thread T27 here:
          #0 0x7fb0bf6d1602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
          #1 0x55c8f5169fe5 in sf_malloc /git/10.4/mysys/safemalloc.c:118
          #2 0x55c8f513c188 in my_malloc /git/10.4/mysys/my_malloc.c:101
          #3 0x55c8f511c3e3 in reset_root_defaults /git/10.4/mysys/my_alloc.c:151
          #4 0x55c8f38a6f83 in THD::init_for_queries() /git/10.4/sql/sql_class.cc:1337
          #5 0x55c8f3cea4c2 in prepare_new_connection_state(THD*) /git/10.4/sql/sql_connect.cc:1239
          #6 0x55c8f3ceab4b in thd_prepare_connection(THD*) /git/10.4/sql/sql_connect.cc:1323
          #7 0x55c8f3ceb0f0 in do_handle_one_connection(CONNECT*) /git/10.4/sql/sql_connect.cc:1393
          #8 0x55c8f3ceab05 in handle_one_connection /git/10.4/sql/sql_connect.cc:1308
          #9 0x55c8f5029ca5 in pfs_spawn_thread /git/10.4/storage/perfschema/pfs.cc:1862
          #10 0x7fb0be4726b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
       
      Thread T27 created by T0 here:
          #0 0x7fb0bf66f253 in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x36253)
          #1 0x55c8f502a092 in spawn_thread_v1 /git/10.4/storage/perfschema/pfs.cc:1912
          #2 0x55c8f370ab14 in inline_mysql_thread_create /git/10.4/include/mysql/psi/mysql_thread.h:1268
          #3 0x55c8f371fcf7 in create_thread_to_handle_connection(CONNECT*) /git/10.4/sql/mysqld.cc:6330
          #4 0x55c8f37203f7 in create_new_thread(CONNECT*) /git/10.4/sql/mysqld.cc:6400
          #5 0x55c8f3720782 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /git/10.4/sql/mysqld.cc:6517
          #6 0x55c8f37213ff in handle_connections_sockets() /git/10.4/sql/mysqld.cc:6682
          #7 0x55c8f371f1b7 in mysqld_main(int, char**) /git/10.4/sql/mysqld.cc:5952
          #8 0x55c8f370923f in main /git/10.4/sql/main.cc:25
          #9 0x7fb0bd82082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
       
      SUMMARY: AddressSanitizer: use-after-poison /git/10.4/sql/sql_class.cc:2824 Item_change_list::rollback_item_tree_changes()
      Shadow bytes around the buggy address:
        0x0c5680008580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680008590: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800085a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800085b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800085c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c56800085d0: f7[f7]00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800085e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800085f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680008600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680008610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680008620: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07 
        Heap left redzone:       fa
        Heap right redzone:      fb
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack partial redzone:   f4
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
      ==2451==ABORTING
      ----------SERVER LOG END-------------
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.