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

Server crashes in in open_and_process_table or ASAN heap-use-after-free in is_temporary_table upon creating/flushing sequences

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      CREATE SEQUENCE seq ENGINE=InnoDB;
      --connect (con1,localhost,root,,test)
      --send
      	CREATE TABLE t LIKE seq;
      --connection default
      FLUSH TABLES;
       
      # Cleanup
      --connection con1
      --reap
      --disconnect
      --connection default
      DROP TABLE t, seq;
      

      10.3 b8c92d752c34e5 ASAN

      ==23992==ERROR: AddressSanitizer: heap-use-after-free on address 0x61f00006d6f0 at pc 0x556a5ed35056 bp 0x7f2b649a7fa0 sp 0x7f2b649a7f98
      READ of size 8 at 0x61f00006d6f0 thread T28
          #0 0x556a5ed35055 in is_temporary_table(TABLE_LIST*) /data/src/10.3/sql/sql_base.h:611
          #1 0x556a5ed4d872 in open_and_process_table /data/src/10.3/sql/sql_base.cc:3369
          #2 0x556a5ed50ae5 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/src/10.3/sql/sql_base.cc:3987
          #3 0x556a5ed555cc in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /data/src/10.3/sql/sql_base.cc:4867
          #4 0x556a5ed34eba in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /data/src/10.3/sql/sql_base.h:498
          #5 0x556a5f34a0c2 in sequence_insert(THD*, LEX*, TABLE_LIST*) /data/src/10.3/sql/sql_sequence.cc:311
          #6 0x556a5f08fbbf in mysql_create_table_no_lock(THD*, char const*, char const*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /data/src/10.3/sql/sql_table.cc:5112
          #7 0x556a5f093f4f in mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*) /data/src/10.3/sql/sql_table.cc:5696
          #8 0x556a5ee88395 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4238
          #9 0x556a5eea036d in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7987
          #10 0x556a5ee7abba in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1826
          #11 0x556a5ee77c1b in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1370
          #12 0x556a5f1ee0af in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1401
          #13 0x556a5f1edac4 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1307
          #14 0x556a5fd2bc4e in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #15 0x7f2b810eb493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
          #16 0x7f2b7f4d193e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
       
      0x61f00006d6f0 is located 112 bytes inside of 3092-byte region [0x61f00006d680,0x61f00006e294)
      freed by thread T28 here:
          #0 0x7f2b81355527 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54527)
          #1 0x556a60714afb in free_memory /data/src/10.3/mysys/safemalloc.c:279
          #2 0x556a6071415c in sf_free /data/src/10.3/mysys/safemalloc.c:197
          #3 0x556a606e2f0c in my_free /data/src/10.3/mysys/my_malloc.c:215
          #4 0x556a5f38f697 in intern_close_table /data/src/10.3/sql/table_cache.cc:224
          #5 0x556a5f38f8c1 in tc_remove_table /data/src/10.3/sql/table_cache.cc:260
          #6 0x556a5f390a32 in tc_release_table(TABLE*) /data/src/10.3/sql/table_cache.cc:472
          #7 0x556a5ed42f84 in close_thread_table(THD*, TABLE**) /data/src/10.3/sql/sql_base.cc:906
          #8 0x556a5ed426a3 in close_thread_tables(THD*) /data/src/10.3/sql/sql_base.cc:848
          #9 0x556a5f349ea1 in sequence_insert(THD*, LEX*, TABLE_LIST*) /data/src/10.3/sql/sql_sequence.cc:292
          #10 0x556a5f08fbbf in mysql_create_table_no_lock(THD*, char const*, char const*, Table_specification_st*, Alter_info*, bool*, int, TABLE_LIST*) /data/src/10.3/sql/sql_table.cc:5112
          #11 0x556a5f093f4f in mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*) /data/src/10.3/sql/sql_table.cc:5696
          #12 0x556a5ee88395 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4238
          #13 0x556a5eea036d in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7987
          #14 0x556a5ee7abba in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1826
          #15 0x556a5ee77c1b in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1370
          #16 0x556a5f1ee0af in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1401
          #17 0x556a5f1edac4 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1307
          #18 0x556a5fd2bc4e in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #19 0x7f2b810eb493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
       
      previously allocated by thread T28 here:
          #0 0x7f2b8135573f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x556a607138fe in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
          #2 0x556a606e25ff in my_malloc /data/src/10.3/mysys/my_malloc.c:101
          #3 0x556a5ed46fc9 in open_table(THD*, TABLE_LIST*, Open_table_context*) /data/src/10.3/sql/sql_base.cc:1901
          #4 0x556a5ed4e189 in open_and_process_table /data/src/10.3/sql/sql_base.cc:3467
          #5 0x556a5ed50ae5 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/src/10.3/sql/sql_base.cc:3987
          #6 0x556a5ee01277 in open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int) /data/src/10.3/sql/sql_base.h:467
          #7 0x556a5f093845 in mysql_create_like_table(THD*, TABLE_LIST*, TABLE_LIST*, Table_specification_st*) /data/src/10.3/sql/sql_table.cc:5620
          #8 0x556a5ee88395 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4238
          #9 0x556a5eea036d in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7987
          #10 0x556a5ee7abba in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1826
          #11 0x556a5ee77c1b in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1370
          #12 0x556a5f1ee0af in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1401
          #13 0x556a5f1edac4 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1307
          #14 0x556a5fd2bc4e in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #15 0x7f2b810eb493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
       
      Thread T28 created by T0 here:
          #0 0x7f2b81324bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
          #1 0x556a5fd2c216 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1912
          #2 0x556a5ec4214f in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x556a5ec57c91 in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6518
          #4 0x556a5ec58396 in create_new_thread /data/src/10.3/sql/mysqld.cc:6588
          #5 0x556a5ec593a7 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6863
          #6 0x556a5ec57149 in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6138
          #7 0x556a5ec4067f in main /data/src/10.3/sql/main.cc:25
          #8 0x7f2b7f4092b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
       
      SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.3/sql/sql_base.h:611 is_temporary_table(TABLE_LIST*)
      Shadow bytes around the buggy address:
        0x0c3e80005a80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c3e80005a90: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
        0x0c3e80005aa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c3e80005ab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c3e80005ac0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      =>0x0c3e80005ad0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd
        0x0c3e80005ae0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c3e80005af0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c3e80005b00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c3e80005b10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c3e80005b20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      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
        Contiguous container OOB:fc
        ASan internal:           fe
      ==23992==ABORTING
      

      10.3 b8c92d752c34e51dbe8ed55

      #3  <signal handler called>
      #4  0x00005631c66ab9ad in open_and_process_table (thd=0x7fa5e8000b00, lex=0x7fa5e80047c8, tables=0x7fa5e8013fc0, counter=0x7fa63050eab4, flags=2080, prelocking_strategy=0x7fa63050eb30, has_prelocking_list=false, ot_ctx=0x7fa63050ea20) at /data/src/10.3/sql/sql_base.cc:3369
      #5  0x00005631c66acf7e in open_tables (thd=0x7fa5e8000b00, options=..., start=0x7fa63050ea98, counter=0x7fa63050eab4, flags=2080, prelocking_strategy=0x7fa63050eb30) at /data/src/10.3/sql/sql_base.cc:3987
      #6  0x00005631c66aed3c in open_and_lock_tables (thd=0x7fa5e8000b00, options=..., tables=0x7fa5e8013950, derived=false, flags=2080, prelocking_strategy=0x7fa63050eb30) at /data/src/10.3/sql/sql_base.cc:4867
      #7  0x00005631c66a13d9 in open_and_lock_tables (thd=0x7fa5e8000b00, tables=0x7fa5e8013950, derived=false, flags=2080) at /data/src/10.3/sql/sql_base.h:498
      #8  0x00005631c692f09a in sequence_insert (thd=0x7fa5e8000b00, lex=0x7fa5e80047c8, table_list=0x7fa5e8013950) at /data/src/10.3/sql/sql_sequence.cc:311
      #9  0x00005631c67fe520 in mysql_create_table_no_lock (thd=0x7fa5e8000b00, db=0x7fa5e8013f80 "test", table_name=0x7fa5e8013918 "t", create_info=0x7fa63050f010, alter_info=0x7fa63050ef60, is_trans=0x7fa63050eeb4, create_table_mode=0, table_list=0x7fa5e8013950) at /data/src/10.3/sql/sql_table.cc:5112
      #10 0x00005631c68001c8 in mysql_create_like_table (thd=0x7fa5e8000b00, table=0x7fa5e8013950, src_table=0x7fa5e8013fc0, create_info=0x7fa6305107b0) at /data/src/10.3/sql/sql_table.cc:5696
      #11 0x00005631c672f1b7 in mysql_execute_command (thd=0x7fa5e8000b00) at /data/src/10.3/sql/sql_parse.cc:4238
      #12 0x00005631c673b050 in mysql_parse (thd=0x7fa5e8000b00, rawbuf=0x7fa5e8013878 "CREATE TABLE t LIKE seq", length=23, parser_state=0x7fa6305115f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7987
      #13 0x00005631c672887f in dispatch_command (command=COM_QUERY, thd=0x7fa5e8000b00, packet=0x7fa5e800b141 "CREATE TABLE t LIKE seq", packet_length=23, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1826
      #14 0x00005631c67272b3 in do_command (thd=0x7fa5e8000b00) at /data/src/10.3/sql/sql_parse.cc:1370
      #15 0x00005631c688e7e8 in do_handle_one_connection (connect=0x5631c9978de0) at /data/src/10.3/sql/sql_connect.cc:1401
      #16 0x00005631c688e575 in handle_one_connection (arg=0x5631c9978de0) at /data/src/10.3/sql/sql_connect.cc:1307
      #17 0x00005631c6d2c1b4 in pfs_spawn_thread (arg=0x5631c9996380) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #18 0x00007fa63ee46494 in start_thread (arg=0x7fa630512700) at pthread_create.c:333
      #19 0x00007fa63d22c93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      The test fails every time for me, but it's still non-deterministic, so run with --repeat if it doesn't fail right away.

      Attachments

        Activity

          People

            monty Michael Widenius
            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.