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

ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=MyISAM;
      --error ER_CANT_DROP_FIELD_OR_KEY
      ALTER TABLE t1 DROP x;
      UPDATE t1 SET b = 0 WHERE a = 'foo';
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 ASAN 3b47587f

      ==2768==ERROR: AddressSanitizer: unknown-crash on address 0x62100007d1df at pc 0x557e7a33c5da bp 0x7fe654597560 sp 0x7fe654597558
      READ of size 1 at 0x62100007d1df thread T5
          #0 0x557e7a33c5d9 in _mi_pack_key /data/src/10.4/storage/myisam/mi_key.c:289
          #1 0x557e7a374bb4 in _mi_record_pos /data/src/10.4/storage/myisam/mi_range.c:161
          #2 0x557e7a3744c0 in mi_records_in_range /data/src/10.4/storage/myisam/mi_range.c:104
          #3 0x557e7a2e081f in ha_myisam::records_in_range(unsigned int, st_key_range*, st_key_range*) /data/src/10.4/storage/myisam/ha_myisam.cc:2324
          #4 0x557e79047f55 in handler::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*) /data/src/10.4/sql/multi_range_read.cc:177
          #5 0x557e790532ac in DsMrr_impl::dsmrr_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*) /data/src/10.4/sql/multi_range_read.cc:1579
          #6 0x557e7a2e21c5 in ha_myisam::multi_range_read_info_const(unsigned int, st_range_seq_if*, void*, unsigned int, unsigned int*, unsigned int*, Cost_estimate*) /data/src/10.4/storage/myisam/ha_myisam.cc:2549
          #7 0x557e79754828 in check_quick_select /data/src/10.4/sql/opt_range.cc:11070
          #8 0x557e7973e709 in get_key_scans_params /data/src/10.4/sql/opt_range.cc:7374
          #9 0x557e79723900 in SQL_SELECT::test_quick_select(THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool, bool, bool, bool) /data/src/10.4/sql/opt_range.cc:2902
          #10 0x557e78eb65cc in SQL_SELECT::check_quick(THD*, bool, unsigned long long) /data/src/10.4/sql/opt_range.h:1649
          #11 0x557e78ea123e in mysql_update(THD*, TABLE_LIST*, List<Item>&, List<Item>&, Item*, unsigned int, st_order*, unsigned long long, enum_duplicates, bool, unsigned long long*, unsigned long long*) /data/src/10.4/sql/sql_update.cc:522
          #12 0x557e78c25f3a in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:4647
          #13 0x557e78c3d996 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:8157
          #14 0x557e78c15b9f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1829
          #15 0x557e78c129a0 in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1358
          #16 0x557e78fa60d3 in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1399
          #17 0x557e78fa5acc in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1302
          #18 0x557e79b6fdae in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #19 0x7fe65f91a493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
          #20 0x7fe65dd0093e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
       
      0x62100007d1df is located 223 bytes inside of 4172-byte region [0x62100007d100,0x62100007e14c)
      allocated by thread T5 here:
          #0 0x7fe65fb8473f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x557e7a51f7c3 in sf_malloc /data/src/10.4/mysys/safemalloc.c:118
          #2 0x557e7a4f00be in my_malloc /data/src/10.4/mysys/my_malloc.c:101
          #3 0x557e7a4cf7b6 in alloc_root /data/src/10.4/mysys/my_alloc.c:250
          #4 0x557e797223ce in SQL_SELECT::test_quick_select(THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool, bool, bool, bool) /data/src/10.4/sql/opt_range.cc:2731
          #5 0x557e78eb65cc in SQL_SELECT::check_quick(THD*, bool, unsigned long long) /data/src/10.4/sql/opt_range.h:1649
          #6 0x557e78ea123e in mysql_update(THD*, TABLE_LIST*, List<Item>&, List<Item>&, Item*, unsigned int, st_order*, unsigned long long, enum_duplicates, bool, unsigned long long*, unsigned long long*) /data/src/10.4/sql/sql_update.cc:522
          #7 0x557e78c25f3a in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:4647
          #8 0x557e78c3d996 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:8157
          #9 0x557e78c15b9f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1829
          #10 0x557e78c129a0 in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1358
          #11 0x557e78fa60d3 in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1399
          #12 0x557e78fa5acc in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1302
          #13 0x557e79b6fdae in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #14 0x7fe65f91a493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
       
      Thread T5 created by T0 here:
          #0 0x7fe65fb53bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
          #1 0x557e79b70376 in spawn_thread_v1 /data/src/10.4/storage/perfschema/pfs.cc:1912
          #2 0x557e789604a6 in inline_mysql_thread_create /data/src/10.4/include/mysql/psi/mysql_thread.h:1268
          #3 0x557e789755b2 in create_thread_to_handle_connection(CONNECT*) /data/src/10.4/sql/mysqld.cc:6133
          #4 0x557e78975cb7 in create_new_thread(CONNECT*) /data/src/10.4/sql/mysqld.cc:6203
          #5 0x557e78976047 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.4/sql/mysqld.cc:6301
          #6 0x557e78976c93 in handle_connections_sockets() /data/src/10.4/sql/mysqld.cc:6459
          #7 0x557e78974ded in mysqld_main(int, char**) /data/src/10.4/sql/mysqld.cc:5791
          #8 0x557e7895e32f in main /data/src/10.4/sql/main.cc:25
          #9 0x7fe65dc382b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
       
      SUMMARY: AddressSanitizer: unknown-crash /data/src/10.4/storage/myisam/mi_key.c:289 _mi_pack_key
      Shadow bytes around the buggy address:
        0x0c42800079e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c42800079f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c4280007a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c4280007a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c4280007a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c4280007a30: 00 00 00 00 00 00 00 00 00 04 04[04]00 00 00 00
        0x0c4280007a40: 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00
        0x0c4280007a50: 00 00 00 00 00 00 00 00 00 00 00 f7 f7 f7 f7 f7
        0x0c4280007a60: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4280007a70: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4280007a80: 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
        Contiguous container OOB:fc
        ASan internal:           fe
      ==2768==ABORTING
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: