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

AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes

    XMLWordPrintable

Details

    Description

      perl ./runall-new.pl --no-mask --seed=time --threads=2 --duration=300 --queries=100M  --mysqld=--max-statement-time=30 --redefine=conf/mariadb/versioning.yy --views --grammar=conf/partitioning/partitions.yy --engine=MyISAM --mysqld=--default-storage-engine=MyISAM --basedir1=/git/10.4-selectivity4 --vardir1=/1

      ==9654==ERROR: AddressSanitizer: use-after-poison on address 0x6210007545a8 at pc 0x5642e1afd2de bp 0x7faed3a531f0 sp 0x7faed3a531e0
      WRITE of size 2 at 0x6210007545a8 thread T35
          #0 0x5642e1afd2dd in create_key_parts_for_pseudo_indexes /git/10.4-selectivity4/sql/opt_range.cc:2877
          #1 0x5642e1afebcc in calculate_cond_selectivity_for_table(THD*, TABLE*, Item**) /git/10.4-selectivity4/sql/opt_range.cc:3178
          #2 0x5642e11968cb in make_join_statistics /git/10.4-selectivity4/sql/sql_select.cc:5043
          #3 0x5642e1179b4d in JOIN::optimize_inner() /git/10.4-selectivity4/sql/sql_select.cc:1932
          #4 0x5642e1175173 in JOIN::optimize() /git/10.4-selectivity4/sql/sql_select.cc:1451
          #5 0x5642e1190011 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*) /git/10.4-selectivity4/sql/sql_select.cc:4267
          #6 0x5642e116a752 in handle_select(THD*, LEX*, select_result*, unsigned long) /git/10.4-selectivity4/sql/sql_select.cc:385
          #7 0x5642e10f0e49 in execute_sqlcom_select /git/10.4-selectivity4/sql/sql_parse.cc:6554
          #8 0x5642e10df5a3 in mysql_execute_command(THD*) /git/10.4-selectivity4/sql/sql_parse.cc:3773
          #9 0x5642e10f93ee in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /git/10.4-selectivity4/sql/sql_parse.cc:8091
          #10 0x5642e10d42eb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /git/10.4-selectivity4/sql/sql_parse.cc:1851
          #11 0x5642e10d1483 in do_command(THD*) /git/10.4-selectivity4/sql/sql_parse.cc:1396
          #12 0x5642e14262f4 in do_handle_one_connection(CONNECT*) /git/10.4-selectivity4/sql/sql_connect.cc:1402
          #13 0x5642e1425cd1 in handle_one_connection /git/10.4-selectivity4/sql/sql_connect.cc:1308
          #14 0x7faf044546b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
          #15 0x7faf038e941c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
       
      0x6210007545a8 is located 168 bytes inside of 4172-byte region [0x621000754500,0x62100075554c)
      allocated by thread T35 here:
          #0 0x7faf056b3602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
          #1 0x5642e28922ab in sf_malloc /git/10.4-selectivity4/mysys/safemalloc.c:118
          #2 0x5642e286444e in my_malloc /git/10.4-selectivity4/mysys/my_malloc.c:101
          #3 0x5642e2844f43 in alloc_root /git/10.4-selectivity4/mysys/my_alloc.c:250
          #4 0x5642e1afd0ba in create_key_parts_for_pseudo_indexes /git/10.4-selectivity4/sql/opt_range.cc:2861
          #5 0x5642e1afebcc in calculate_cond_selectivity_for_table(THD*, TABLE*, Item**) /git/10.4-selectivity4/sql/opt_range.cc:3178
          #6 0x5642e11968cb in make_join_statistics /git/10.4-selectivity4/sql/sql_select.cc:5043
          #7 0x5642e1179b4d in JOIN::optimize_inner() /git/10.4-selectivity4/sql/sql_select.cc:1932
          #8 0x5642e1175173 in JOIN::optimize() /git/10.4-selectivity4/sql/sql_select.cc:1451
          #9 0x5642e1190011 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*) /git/10.4-selectivity4/sql/sql_select.cc:4267
          #10 0x5642e116a752 in handle_select(THD*, LEX*, select_result*, unsigned long) /git/10.4-selectivity4/sql/sql_select.cc:385
          #11 0x5642e10f0e49 in execute_sqlcom_select /git/10.4-selectivity4/sql/sql_parse.cc:6554
          #12 0x5642e10df5a3 in mysql_execute_command(THD*) /git/10.4-selectivity4/sql/sql_parse.cc:3773
          #13 0x5642e10f93ee in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /git/10.4-selectivity4/sql/sql_parse.cc:8091
          #14 0x5642e10d42eb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /git/10.4-selectivity4/sql/sql_parse.cc:1851
          #15 0x5642e10d1483 in do_command(THD*) /git/10.4-selectivity4/sql/sql_parse.cc:1396
          #16 0x5642e14262f4 in do_handle_one_connection(CONNECT*) /git/10.4-selectivity4/sql/sql_connect.cc:1402
          #17 0x5642e1425cd1 in handle_one_connection /git/10.4-selectivity4/sql/sql_connect.cc:1308
          #18 0x7faf044546b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
       
      Thread T35 created by T0 here:
          #0 0x7faf05651253 in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x36253)
          #1 0x5642e28bce0c in spawn_thread_noop /git/10.4-selectivity4/mysys/psi_noop.c:187
          #2 0x5642e0e4b034 in inline_mysql_thread_create /git/10.4-selectivity4/include/mysql/psi/mysql_thread.h:1268
          #3 0x5642e0e60212 in create_thread_to_handle_connection(CONNECT*) /git/10.4-selectivity4/sql/mysqld.cc:6330
          #4 0x5642e0e60912 in create_new_thread(CONNECT*) /git/10.4-selectivity4/sql/mysqld.cc:6400
          #5 0x5642e0e60c9d in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /git/10.4-selectivity4/sql/mysqld.cc:6517
          #6 0x5642e0e6191a in handle_connections_sockets() /git/10.4-selectivity4/sql/mysqld.cc:6682
          #7 0x5642e0e5f6d2 in mysqld_main(int, char**) /git/10.4-selectivity4/sql/mysqld.cc:5952
          #8 0x5642e0e4975f in main /git/10.4-selectivity4/sql/main.cc:25
          #9 0x7faf0380282f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
       
      SUMMARY: AddressSanitizer: use-after-poison /git/10.4-selectivity4/sql/opt_range.cc:2877 create_key_parts_for_pseudo_indexes
      Shadow bytes around the buggy address:
        0x0c42800e2860: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c42800e2870: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c42800e2880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c42800e2890: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c42800e28a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c42800e28b0: 00 00 00 00 00[f7]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c42800e28c0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c42800e28d0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c42800e28e0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c42800e28f0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c42800e2900: 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
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
      ==9654==ABORTING
      

      to reproduce: datadir from attached file and run "SELECT `col_int_nokey` FROM u WHERE `col_int_nokey`=1;"

      Attachments

        1. dt.7z
          923 kB
          Alice Sherepa

        Issue Links

          Activity

            People

              varun Varun Gupta (Inactive)
              alice Alice Sherepa
              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.