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

ASAN errors in my_compress_buffer / Item_func_compress::val_str

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4
    • 10.5, 10.6, 10.11, 11.1, 11.2, 11.4
    • Server
    • None

    Description

      Note: When it comes to including the test case into the regression suite, I suggest wrapping COMPRESS call below into HEX, as in HEX(COMPRESS(a)) or something similar. It still reproduces the failure, but when it doesn't fail, e.g. on a non-ASAN build or after a fix, it will help to avoid binary output in stdout, which is never good for MTR.

      --source include/have_sequence.inc
      CREATE TABLE t (id INT, a VARCHAR(1024) AS (id));
      INSERT INTO t (id) SELECT seq FROM seq_1_to_10000;
      ALTER TABLE t ADD b VARCHAR(32);
      SELECT COMPRESS(a) AS f FROM t GROUP BY f WITH ROLLUP;
       
      # Cleanup
      DROP TABLE t;
      

      10.4 c9b0c006e0491c9f7a1dae07090db3cdb87da446

      ==990757==ERROR: AddressSanitizer: use-after-poison on address 0x61d0002278d0 at pc 0x7ff69f84814b bp 0x7ff69623dd40 sp 0x7ff69623d4f0
      READ of size 48830 at 0x61d0002278d0 thread T5
          #0 0x7ff69f84814a in __interceptor_memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
          #1 0x7ff69feefb81  (/lib/x86_64-linux-gnu/libz.so.1+0x4b81)
          #2 0x7ff69fef1067  (/lib/x86_64-linux-gnu/libz.so.1+0x6067)
          #3 0x7ff69fef209b in deflate (/lib/x86_64-linux-gnu/libz.so.1+0x709b)
          #4 0x5633d0bea497 in my_compress_buffer /data/bld/10.4-asan/mysys/my_compress.c:119
          #5 0x5633cfa1eb60 in Item_func_compress::val_str(String*) /data/bld/10.4-asan/sql/item_strfunc.cc:4313
          #6 0x5633cf8d20a9 in Cached_item_str::cmp() /data/bld/10.4-asan/sql/item_buff.cc:84
          #7 0x5633cf1d8eb2 in test_if_group_changed(List<Cached_item>&) /data/bld/10.4-asan/sql/sql_select.cc:25605
          #8 0x5633cf1c0ac3 in end_send_group(JOIN*, st_join_table*, bool) /data/bld/10.4-asan/sql/sql_select.cc:22248
          #9 0x5633cf1b7e10 in evaluate_join_record /data/bld/10.4-asan/sql/sql_select.cc:21160
          #10 0x5633cf1b6d65 in sub_select(JOIN*, st_join_table*, bool) /data/bld/10.4-asan/sql/sql_select.cc:20972
          #11 0x5633cf1b4550 in do_select /data/bld/10.4-asan/sql/sql_select.cc:20454
          #12 0x5633cf1433a0 in JOIN::exec_inner() /data/bld/10.4-asan/sql/sql_select.cc:4629
          #13 0x5633cf1409ab in JOIN::exec() /data/bld/10.4-asan/sql/sql_select.cc:4411
          #14 0x5633cf144a39 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/bld/10.4-asan/sql/sql_select.cc:4850
          #15 0x5633cf1150ca in handle_select(THD*, LEX*, select_result*, unsigned long) /data/bld/10.4-asan/sql/sql_select.cc:442
          #16 0x5633cf07f984 in execute_sqlcom_select /data/bld/10.4-asan/sql/sql_parse.cc:6549
          #17 0x5633cf06c90f in mysql_execute_command(THD*) /data/bld/10.4-asan/sql/sql_parse.cc:3980
          #18 0x5633cf088c74 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/bld/10.4-asan/sql/sql_parse.cc:8088
          #19 0x5633cf05e893 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/bld/10.4-asan/sql/sql_parse.cc:1857
          #20 0x5633cf05b402 in do_command(THD*) /data/bld/10.4-asan/sql/sql_parse.cc:1378
          #21 0x5633cf46291c in do_handle_one_connection(CONNECT*) /data/bld/10.4-asan/sql/sql_connect.cc:1419
          #22 0x5633cf462233 in handle_one_connection /data/bld/10.4-asan/sql/sql_connect.cc:1323
          #23 0x5633d00c8775 in pfs_spawn_thread /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
          #24 0x7ff69f2a8043 in start_thread nptl/pthread_create.c:442
          #25 0x7ff69f32861b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
       
      0x61d000227d08 is located 0 bytes to the right of 2184-byte region [0x61d000227480,0x61d000227d08)
      allocated by thread T5 here:
          #0 0x7ff69f8b89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
          #1 0x5633d0c049c3 in my_malloc /data/bld/10.4-asan/mysys/my_malloc.c:101
          #2 0x5633d0be1a8e in alloc_root /data/bld/10.4-asan/mysys/my_alloc.c:246
          #3 0x5633cf38ff01 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/bld/10.4-asan/sql/table.cc:3845
          #4 0x5633ceed62af in open_table(THD*, TABLE_LIST*, Open_table_context*) /data/bld/10.4-asan/sql/sql_base.cc:2116
          #5 0x5633ceedf987 in open_and_process_table /data/bld/10.4-asan/sql/sql_base.cc:3919
          #6 0x5633ceee2443 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/bld/10.4-asan/sql/sql_base.cc:4401
          #7 0x5633ceee755e in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /data/bld/10.4-asan/sql/sql_base.cc:5348
          #8 0x5633cee406c1 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /data/bld/10.4-asan/sql/sql_base.h:504
          #9 0x5633cf07ef04 in execute_sqlcom_select /data/bld/10.4-asan/sql/sql_parse.cc:6470
          #10 0x5633cf06c90f in mysql_execute_command(THD*) /data/bld/10.4-asan/sql/sql_parse.cc:3980
          #11 0x5633cf088c74 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/bld/10.4-asan/sql/sql_parse.cc:8088
          #12 0x5633cf05e893 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/bld/10.4-asan/sql/sql_parse.cc:1857
          #13 0x5633cf05b402 in do_command(THD*) /data/bld/10.4-asan/sql/sql_parse.cc:1378
          #14 0x5633cf46291c in do_handle_one_connection(CONNECT*) /data/bld/10.4-asan/sql/sql_connect.cc:1419
          #15 0x5633cf462233 in handle_one_connection /data/bld/10.4-asan/sql/sql_connect.cc:1323
          #16 0x5633d00c8775 in pfs_spawn_thread /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
          #17 0x7ff69f2a8043 in start_thread nptl/pthread_create.c:442
       
      Thread T5 created by T0 here:
          #0 0x7ff69f849726 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:207
          #1 0x5633d00c8b62 in spawn_thread_v1 /data/bld/10.4-asan/storage/perfschema/pfs.cc:1919
          #2 0x5633ced6121c in inline_mysql_thread_create /data/bld/10.4-asan/include/mysql/psi/mysql_thread.h:1275
          #3 0x5633ced789fb in create_thread_to_handle_connection(CONNECT*) /data/bld/10.4-asan/sql/mysqld.cc:6311
          #4 0x5633ced79146 in create_new_thread(CONNECT*) /data/bld/10.4-asan/sql/mysqld.cc:6381
          #5 0x5633ced79614 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/bld/10.4-asan/sql/mysqld.cc:6479
          #6 0x5633ced7a4c0 in handle_connections_sockets() /data/bld/10.4-asan/sql/mysqld.cc:6637
          #7 0x5633ced7815e in mysqld_main(int, char**) /data/bld/10.4-asan/sql/mysqld.cc:5969
          #8 0x5633ced5f0a8 in main /data/bld/10.4-asan/sql/main.cc:25
          #9 0x7ff69f2461c9 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:827 in __interceptor_memcpy
      Shadow bytes around the buggy address:
        0x0c3a8003cec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003ced0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c3a8003cf10: 00 00 00 00 00 00 00 00 00 00[f7]00 00 00 00 00
        0x0c3a8003cf20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cf30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cf40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cf50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c3a8003cf60: 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
        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
      ==990757==ABORTING
      

      A release build doesn't fail, but with ASAN errors it doesn't mean much.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.