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

ASAN errors in Item_ident::print / generate_partition_syntax

    XMLWordPrintable

Details

    Description

      --source include/have_partition.inc
       
      CREATE TABLE t (a INT) PARTITION BY HASH(a);
      --error ER_BAD_FIELD_ERROR
      ALTER TABLE t CHANGE a b INT, DROP a;
       
      SHOW CREATE TABLE t;
       
      # Cleanup
      DROP TABLE t;
      

      10.3 4e920673

      ==1627027==ERROR: AddressSanitizer: use-after-poison on address 0x62b0000009f8 at pc 0x56195a16f9b1 bp 0x7f78e2248a60 sp 0x7f78e2248a58
      READ of size 1 at 0x62b0000009f8 thread T5
          #0 0x56195a16f9b0 in Item_ident::print(String*, enum_query_type) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/item.cc:3425
          #1 0x56195a192e63 in Item_field::print(String*, enum_query_type) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/item.cc:7871
          #2 0x56195a1572a6 in Item::print_parenthesised(String*, enum_query_type, precedence) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/item.cc:611
          #3 0x561959ba8d9b in Item::print_for_table_def(String*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/item.h:1477
          #4 0x56195a575c90 in generate_partition_syntax(THD*, partition_info*, unsigned int*, bool, HA_CREATE_INFO*, Alter_info*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_partition.cc:2697
          #5 0x561959b58e4b in show_create_table(THD*, TABLE_LIST*, String*, Table_specification_st*, enum_with_db_name) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_show.cc:2494
          #6 0x561959b5023c in mysqld_show_create_get_fields(THD*, TABLE_LIST*, List<Item>*, String*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_show.cc:1352
          #7 0x561959b50a79 in mysqld_show_create(THD*, TABLE_LIST*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_show.cc:1426
          #8 0x5619599bb976 in mysql_execute_command(THD*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:4304
          #9 0x5619599d4e99 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:7855
          #10 0x5619599ac4e7 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1852
          #11 0x5619599a909f in do_command(THD*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1398
          #12 0x561959d6cb8b in do_handle_one_connection(CONNECT*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1404
          #13 0x561959d6c487 in handle_one_connection /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1309
          #14 0x56195b319928 in pfs_spawn_thread /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/perfschema/pfs.cc:1869
          #15 0x7f78ecfd9ea6 in start_thread nptl/pthread_create.c:477
          #16 0x7f78ecef9aee in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xfcaee)
       
      0x62b0000009f8 is located 2040 bytes inside of 24608-byte region [0x62b000000200,0x62b000006220)
      allocated by thread T5 here:
          #0 0x7f78ed8dfe8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
          #1 0x56195b42dc44 in my_malloc /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/mysys/my_malloc.c:101
          #2 0x56195b40a19c in reset_root_defaults /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/mysys/my_alloc.c:152
          #3 0x5619598adf47 in THD::init_for_queries() /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_class.cc:1338
          #4 0x561959d6bd8a in prepare_new_connection_state(THD*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1239
          #5 0x561959d6c4cd in thd_prepare_connection(THD*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1324
          #6 0x561959d6cab9 in do_handle_one_connection(CONNECT*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1394
          #7 0x561959d6c487 in handle_one_connection /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1309
          #8 0x56195b319928 in pfs_spawn_thread /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/perfschema/pfs.cc:1869
          #9 0x7f78ecfd9ea6 in start_thread nptl/pthread_create.c:477
       
      Thread T5 created by T0 here:
          #0 0x7f78ed88b2a2 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:214
          #1 0x56195b319d15 in spawn_thread_v1 /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/perfschema/pfs.cc:1919
          #2 0x5619596e0e4c in inline_mysql_thread_create /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/include/mysql/psi/mysql_thread.h:1275
          #3 0x5619596f9029 in create_thread_to_handle_connection(CONNECT*) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/mysqld.cc:6677
          #4 0x5619596f9789 in create_new_thread /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/mysqld.cc:6747
          #5 0x5619596fa8f3 in handle_connections_sockets() /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/mysqld.cc:7005
          #6 0x5619596f83a9 in mysqld_main(int, char**) /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/mysqld.cc:6299
          #7 0x5619596df624 in main /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/main.cc:25
          #8 0x7f78ece20d09 in __libc_start_main ../csu/libc-start.c:308
       
      SUMMARY: AddressSanitizer: use-after-poison /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/item.cc:3425 in Item_ident::print(String*, enum_query_type)
      Shadow bytes around the buggy address:
        0x0c567fff80e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff80f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff8100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff8110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff8120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c567fff8130: 00 00 00 00 00 00 f7 05 f7 f7 f7 f7 f7 f7 f7[f7]
        0x0c567fff8140: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c567fff8150: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c567fff8160: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c567fff8170: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c567fff8180: 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
        Shadow gap:              cc
      ==1627027==ABORTING
      

      Reproducible on 10.3, 10.4.
      Couldn't reproduce with the provided test case on 10.5+.
      The failure started happening on 10.3 after this commit:

      commit 0779e2cb1013556c4d67bcc326706dfd449db392
      Author: Aleksey Midenkov
      Date:   Wed Oct 5 17:46:51 2022 +0300
       
          MDEV-28576 RENAME COLUMN with NOCOPY algorithm leads to corrupt partitioned table
      

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.