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

ASAN errors in cmp_dtuple_rec_with_match_low / check_key_referential_integrity

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Duplicate
    • N/A
    • N/A
    • Server
    • None

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (pk DATETIME PRIMARY KEY, a DATE, b DATE, KEY(a), KEY(b)) ENGINE=InnoDB;
      INSERT INTO t VALUES ('2000-01-01 00:00:00','2000-01-01','2000-01-01');
      ALTER TABLE t ADD FOREIGN KEY (a) REFERENCES t (b);
      CHECK TABLE t EXTENDED;
       
      # Cleanup
      DROP TABLE t;
      

      bb-11.8-check-table 01b0c6c996db756fc40d51178d669fcfbec7a1d7

      ==279812==ERROR: AddressSanitizer: use-after-poison on address 0x6290000fbe94 at pc 0x7f80960aa270 bp 0x7f8085bfa180 sp 0x7f8085bf9930
      READ of size 5 at 0x6290000fbe94 thread T11
          #0 0x7f80960aa26f in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:860
          #1 0x7f80960aa908 in __interceptor_memcmp ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:892
          #2 0x7f80960aa908 in __interceptor_memcmp ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:887
          #3 0x55b72ebc899b in cmp_data(unsigned long, unsigned long, bool, unsigned char const*, unsigned long, unsigned char const*, unsigned long) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/rem/rem0cmp.cc:247
          #4 0x55b72ebc9c0f in cmp_dtuple_rec_with_match_low(dtuple_t const*, unsigned char const*, dict_index_t const*, unsigned short const*, unsigned long, unsigned long*) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/rem/rem0cmp.cc:405
          #5 0x55b72eb41ab9 in page_cur_search_with_match(dtuple_t const*, page_cur_mode_t, unsigned long*, unsigned long*, page_cur_t*, rtr_info*) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/page/page0cur.cc:473
          #6 0x55b72eebc6a3 in btr_cur_t::search_leaf(dtuple_t const*, page_cur_mode_t, btr_latch_mode, mtr_t*) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/btr/btr0cur.cc:1409
          #7 0x55b72ec52e1a in btr_pcur_open_with_no_init(dtuple_t const*, page_cur_mode_t, btr_latch_mode, btr_pcur_t*, mtr_t*) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/include/btr0pcur.inl:322
          #8 0x55b72ed2790e in row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/row/row0sel.cc:4797
          #9 0x55b72e831365 in ha_innobase::index_read(unsigned char*, unsigned char const*, unsigned int, ha_rkey_function) /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/innobase/handler/ha_innodb.cc:8982
          #10 0x55b72dc4330e in handler::index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/handler.h:4220
          #11 0x55b72de02ee5 in handler::ha_index_read_map(unsigned char*, unsigned char const*, unsigned long, ha_rkey_function) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/handler.cc:3829
          #12 0x55b72de28649 in handler::check_record_reference(st_key const*, st_key const*, unsigned long, unsigned char*, unsigned int, unsigned char const*, unsigned char*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/handler.cc:7964
          #13 0x55b72d989004 in check_key_referential_integrity /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_admin.cc:1746
          #14 0x55b72d989904 in check_foreign_key_relation /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_admin.cc:1853
          #15 0x55b72d98a357 in check_foreign_key_relations(THD*, TABLE*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_admin.cc:1913
          #16 0x55b72de11c9b in handler::ha_check(THD*, st_ha_check_opt*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/handler.cc:5398
          #17 0x55b72d981db2 in mysql_admin_table /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_admin.cc:942
          #18 0x55b72d987f0f in Sql_cmd_check_table::execute(THD*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_admin.cc:1652
          #19 0x55b72d47120a in mysql_execute_command(THD*, bool) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_parse.cc:5872
          #20 0x55b72d47e229 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_parse.cc:7901
          #21 0x55b72d45536a in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_parse.cc:1903
          #22 0x55b72d452072 in do_command(THD*, bool) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_parse.cc:1416
          #23 0x55b72d944b62 in do_handle_one_connection(CONNECT*, bool) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_connect.cc:1415
          #24 0x55b72d9446c1 in handle_one_connection /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_connect.cc:1327
          #25 0x55b72e5f010b in pfs_spawn_thread /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/perfschema/pfs.cc:2198
          #26 0x7f80954a8043 in start_thread nptl/pthread_create.c:442
          #27 0x7f809552861b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
      0x6290000fbe94 is located 7316 bytes inside of 16400-byte region [0x6290000fa200,0x6290000fe210)
      allocated by thread T11 here:
          #0 0x7f80960b89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x55b72f37dbb9 in my_malloc /data/bld/preview-11.8-bb-11.8-check-table-asan/mysys/my_malloc.c:93
          #2 0x55b72f35017a in root_alloc /data/bld/preview-11.8-bb-11.8-check-table-asan/mysys/my_alloc.c:66
          #3 0x55b72f35116f in reset_root_defaults /data/bld/preview-11.8-bb-11.8-check-table-asan/mysys/my_alloc.c:244
          #4 0x55b72d30ca1e in THD::init_for_queries() /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_class.cc:1510
          #5 0x55b72d943f92 in prepare_new_connection_state(THD*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_connect.cc:1253
          #6 0x55b72d944742 in thd_prepare_connection(THD*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_connect.cc:1348
          #7 0x55b72d944b26 in do_handle_one_connection(CONNECT*, bool) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_connect.cc:1405
          #8 0x55b72d9446c1 in handle_one_connection /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/sql_connect.cc:1327
          #9 0x55b72e5f010b in pfs_spawn_thread /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/perfschema/pfs.cc:2198
          #10 0x7f80954a8043 in start_thread nptl/pthread_create.c:442
       
      Thread T11 created by T0 here:
          #0 0x7f8096049726 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:207
          #1 0x55b72e5ebead in my_thread_create /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/perfschema/my_thread.h:38
          #2 0x55b72e5f04fa in pfs_spawn_thread_v1 /data/bld/preview-11.8-bb-11.8-check-table-asan/storage/perfschema/pfs.cc:2249
          #3 0x55b72d06daa0 in inline_mysql_thread_create /data/bld/preview-11.8-bb-11.8-check-table-asan/include/mysql/psi/mysql_thread.h:1139
          #4 0x55b72d08633f in create_thread_to_handle_connection(CONNECT*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/mysqld.cc:6266
          #5 0x55b72d086964 in create_new_thread(CONNECT*) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/mysqld.cc:6328
          #6 0x55b72d086c4f in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/mysqld.cc:6390
          #7 0x55b72d0878d7 in handle_connections_sockets() /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/mysqld.cc:6502
          #8 0x55b72d08450a in run_main_loop /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/mysqld.cc:5744
          #9 0x55b72d085c0e in mysqld_main(int, char**) /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/mysqld.cc:6167
          #10 0x55b72d06cd68 in main /data/bld/preview-11.8-bb-11.8-check-table-asan/sql/main.cc:34
          #11 0x7f80954461c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
       
      SUMMARY: AddressSanitizer: use-after-poison ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:860 in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long)
      Shadow bytes around the buggy address:
        0x0c5280017780: f7 01 f7 02 f7 02 f7 00 00 00 00 00 00 00 00 00
        0x0c5280017790: 00 00 00 00 00 00 00 00 00 00 00 f7 00 00 f7 00
        0x0c52800177a0: 01 f7 05 f7 02 f7 05 f7 02 f7 00 00 f7 00 00 f7
        0x0c52800177b0: 02 f7 02 f7 01 f7 02 f7 02 f7 00 00 00 00 00 00
        0x0c52800177c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00
      =>0x0c52800177d0: 00 f7[04]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c52800177e0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c52800177f0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c5280017800: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c5280017810: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c5280017820: 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
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        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
      ==279812==ABORTING
      

      Attachments

        Issue Links

          Activity

            People

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