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

AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col

    XMLWordPrintable

Details

    Description

      Note: The test case is very non-deterministic, run with big --repeat (thousands). Usually it fails for me within 20-80 attempts, but sometimes on no apparent reasons it takes hundreds. It seems to be happening somewhat more readily on disk, as opposed to in memory, but it can be a false observation.

      --source include/have_innodb.inc
       
      --connect (con1,localhost,root,,test)
      --connect (con2,localhost,root,,test)
       
      CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
      INSERT INTO t1 (a) VALUES ('foo');
       
      --connection con1
      ALTER TABLE t1 ADD COLUMN b INT;
       
      --connection con2
      --send
          ALTER TABLE t1 ADD PRIMARY KEY (b);
       
      --connection con1
      UPDATE t1 SET b = 1;
       
      --connection default
      DROP TABLE t1;
      

      10.3 ASAN 5098d708

      ==6319==ERROR: AddressSanitizer: use-after-poison on address 0x7fd49f65c000 at pc 0x7fd4aa7a1f7f bp 0x7fd492d6b920 sp 0x7fd492d6b0d0
      READ of size 4294967294 at 0x7fd49f65c000 thread T27
          #0 0x7fd4aa7a1f7e  (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
          #1 0x55f3594bed20 in mem_heap_dup(mem_block_info_t*, void const*, unsigned long) /data/src/10.3/storage/innobase/include/mem0mem.h:242
          #2 0x55f359788418 in row_log_table_get_pk_col /data/src/10.3/storage/innobase/row/row0log.cc:1204
          #3 0x55f359789430 in row_log_table_get_pk(unsigned char const*, dict_index_t*, unsigned long const*, unsigned char*, mem_block_info_t**) /data/src/10.3/storage/innobase/row/row0log.cc:1341
          #4 0x55f359826da9 in row_upd_clust_rec /data/src/10.3/storage/innobase/row/row0upd.cc:2861
          #5 0x55f359828c79 in row_upd_clust_step /data/src/10.3/storage/innobase/row/row0upd.cc:3206
          #6 0x55f359829716 in row_upd /data/src/10.3/storage/innobase/row/row0upd.cc:3307
          #7 0x55f35982a503 in row_upd_step(que_thr_t*) /data/src/10.3/storage/innobase/row/row0upd.cc:3451
          #8 0x55f3597659f3 in row_update_for_mysql(row_prebuilt_t*) /data/src/10.3/storage/innobase/row/row0mysql.cc:1888
          #9 0x55f359484887 in ha_innobase::update_row(unsigned char const*, unsigned char const*) /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8849
          #10 0x55f358f6eba2 in handler::ha_update_row(unsigned char const*, unsigned char const*) /data/src/10.3/sql/handler.cc:6478
          #11 0x55f358abf7d1 in mysql_update(THD*, TABLE_LIST*, List<Item>&, List<Item>&, Item*, unsigned int, st_order*, unsigned long long, bool, unsigned long long*, unsigned long long*) /data/src/10.3/sql/sql_update.cc:954
          #12 0x55f35885508c in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4301
          #13 0x55f35886c1f8 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7815
          #14 0x55f358846f1e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #15 0x55f358843dfd in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #16 0x55f358bb8d68 in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #17 0x55f358bb872f in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #18 0x55f35a01b625 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #19 0x7fd4aa52f4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #20 0x7fd4a8a76d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      AddressSanitizer can not describe address in more detail (wild memory access suspected).
      SUMMARY: AddressSanitizer: use-after-poison (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e) 
      Shadow bytes around the buggy address:
        0x0ffb13ec37b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0ffb13ec37c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0ffb13ec37d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0ffb13ec37e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0ffb13ec37f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0ffb13ec3800:[f7]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0ffb13ec3810: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0ffb13ec3820: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0ffb13ec3830: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0ffb13ec3840: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0ffb13ec3850: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
      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
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      Thread T27 created by T0 here:
          #0 0x7fd4aa775f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x55f35a01ba61 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1912
          #2 0x55f3585b2be0 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x55f3585c7eec in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x55f3585c85cf in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x55f3585c95e7 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x55f3585c73bc in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x55f3585b12ff in main /data/src/10.3/sql/main.cc:25
          #8 0x7fd4a89ae2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      ==6319==ABORTING
      

      Reproducible on 10.3-10.5.
      Couldn't reproduce on 10.2.

      Attachments

        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.