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

ASAN use-after-poison in Field_bit::key_cmp / TABLE::check_period_overlaps

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (s DATE, e DATE, b BIT, PERIOD FOR p(s,e), UNIQUE(b, p WITHOUT OVERLAPS)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('2024-12-21','2034-06-29',0), ('2024-12-21','2034-06-29',1);
      --error ER_DUP_ENTRY
      UPDATE t1 SET b = 1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.5 69077dea ASAN

      ==11631==ERROR: AddressSanitizer: use-after-poison on address 0x619000096e78 at pc 0x5606ff749c61 bp 0x7f59520cdfc0 sp 0x7f59520cdfb8
      READ of size 1 at 0x619000096e78 thread T5
          #0 0x5606ff749c60 in Field_bit::key_cmp(unsigned char const*, unsigned int) const /data/src/10.5/sql/field.cc:9691
          #1 0x5606ff3b414b in Field_bit::cmp(unsigned char const*, unsigned char const*) const /data/src/10.5/sql/field.h:4828
          #2 0x5606ff345967 in TABLE::check_period_overlaps(st_key const&, unsigned char const*, unsigned char const*) /data/src/10.5/sql/table.cc:8693
          #3 0x5606ff7ba946 in handler::ha_check_overlaps(unsigned char const*, unsigned char const*) /data/src/10.5/sql/handler.cc:6859
          #4 0x5606ff7bc9ca in handler::ha_update_row(unsigned char const*, unsigned char const*) /data/src/10.5/sql/handler.cc:7024
          #5 0x5606ff2e0382 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.5/sql/sql_update.cc:1059
          #6 0x5606ff046e9d in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:4370
          #7 0x5606ff05d9fa in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5/sql/sql_parse.cc:7957
          #8 0x5606ff038497 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1840
          #9 0x5606ff035487 in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1359
          #10 0x5606ff3ec5f5 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1411
          #11 0x5606ff3ec064 in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1313
          #12 0x5606fffcceb6 in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:2201
          #13 0x7f595c9184a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #14 0x7f595aa4cd0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      0x619000096e78 is located 1016 bytes inside of 1124-byte region [0x619000096a80,0x619000096ee4)
      allocated by thread T5 here:
          #0 0x7f595cbefd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x560700adfbfb in sf_malloc /data/src/10.5/mysys/safemalloc.c:118
          #2 0x560700ab0dc3 in my_malloc /data/src/10.5/mysys/my_malloc.c:88
          #3 0x560700a91335 in alloc_root /data/src/10.5/mysys/my_alloc.c:243
          #4 0x560700a9192e in multi_alloc_root /data/src/10.5/mysys/my_alloc.c:316
          #5 0x5606ff3207a0 in copy_keys_from_share(TABLE*, st_mem_root*) /data/src/10.5/sql/table.cc:3784
          #6 0x5606ff322276 in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /data/src/10.5/sql/table.cc:3987
          #7 0x5606feecc420 in open_table(THD*, TABLE_LIST*, Open_table_context*) /data/src/10.5/sql/sql_base.cc:1984
          #8 0x5606feed4a3f in open_and_process_table /data/src/10.5/sql/sql_base.cc:3736
          #9 0x5606feed707e in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/src/10.5/sql/sql_base.cc:4210
          #10 0x5606feedbdd6 in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /data/src/10.5/sql/sql_base.cc:5112
          #11 0x5606fee4630b in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /data/src/10.5/sql/sql_base.h:510
          #12 0x5606fef91020 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool, select_result*) /data/src/10.5/sql/sql_insert.cc:756
          #13 0x5606ff047cd8 in mysql_execute_command(THD*) /data/src/10.5/sql/sql_parse.cc:4515
          #14 0x5606ff05d9fa in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.5/sql/sql_parse.cc:7957
          #15 0x5606ff038497 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.5/sql/sql_parse.cc:1840
          #16 0x5606ff035487 in do_command(THD*) /data/src/10.5/sql/sql_parse.cc:1359
          #17 0x5606ff3ec5f5 in do_handle_one_connection(CONNECT*, bool) /data/src/10.5/sql/sql_connect.cc:1411
          #18 0x5606ff3ec064 in handle_one_connection /data/src/10.5/sql/sql_connect.cc:1313
          #19 0x5606fffcceb6 in pfs_spawn_thread /data/src/10.5/storage/perfschema/pfs.cc:2201
          #20 0x7f595c9184a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      Thread T5 created by T0 here:
          #0 0x7f595cb5ef59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x5606fffc7f78 in my_thread_create /data/src/10.5/storage/perfschema/my_thread.h:34
          #2 0x5606fffcd2a5 in pfs_spawn_thread_v1 /data/src/10.5/storage/perfschema/pfs.cc:2252
          #3 0x5606fed80dd7 in inline_mysql_thread_create /data/src/10.5/include/mysql/psi/mysql_thread.h:1321
          #4 0x5606fed93b09 in create_thread_to_handle_connection(CONNECT*) /data/src/10.5/sql/mysqld.cc:5952
          #5 0x5606fed9407e in create_new_thread(CONNECT*) /data/src/10.5/sql/mysqld.cc:6011
          #6 0x5606fed9423b in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.5/sql/mysqld.cc:6076
          #7 0x5606fed94c1e in handle_connections_sockets() /data/src/10.5/sql/mysqld.cc:6203
          #8 0x5606fed9346f in mysqld_main(int, char**) /data/src/10.5/sql/mysqld.cc:5621
          #9 0x5606fed7f5cf in main /data/src/10.5/sql/main.cc:25
          #10 0x7f595a9842e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      SUMMARY: AddressSanitizer: use-after-poison /data/src/10.5/sql/field.cc:9691 in Field_bit::key_cmp(unsigned char const*, unsigned int) const
      Shadow bytes around the buggy address:
        0x0c328000ad70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000ad80: 00 00 00 00 00 00 00 00 00 f7 00 00 f7 02 f7 04
        0x0c328000ad90: f7 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000ada0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000adb0: 00 00 00 00 00 00 00 00 00 f7 02 f7 04 f7 00 00
      =>0x0c328000adc0: 00 00 00 00 f7 00 00 00 04 f7 00 00 f7 00 00[f7]
        0x0c328000add0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 04 fa fa fa
        0x0c328000ade0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c328000adf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000ae00: 00 00 00 00 f7 03 f7 07 07 07 f7 00 00 00 00 f7
        0x0c328000ae10: 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
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==11631==ABORTING
      

      Attachments

        Activity

          People

            nikitamalyavin Nikita Malyavin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.