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

ASAN heap-use-after-free in THD::killed_errno, assertion `m_status == DA_ERROR' or some other signs of corruption

    XMLWordPrintable

Details

    Description

      Setting to Minor and leaving unassigned, as it appears to be a 10.1-only issue, and thus probably isn't worth fixing.

      CREATE TABLE t1 (a INT);
      CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
      SET MAX_SESSION_MEM_USED= 8192;
      --error ER_OPTION_PREVENTS_STATEMENT
      INSERT INTO t1 SELECT 1;
      INSERT INTO t1 () VALUES ();
       
      # Cleanup
      DROP TABLE t1;
      

      10.1 f73db933 ASAN

      ==23951==ERROR: AddressSanitizer: heap-use-after-free on address 0x6250000deb68 at pc 0x5608dadacfdc bp 0x7f522f7807e0 sp 0x7f522f7807d8
      READ of size 4 at 0x6250000deb68 thread T6
          #0 0x5608dadacfdb in THD::killed_errno() /data/src/10.1/sql/sql_class.cc:1952
          #1 0x5608dace9476 in THD::send_kill_message() /data/src/10.1/sql/sql_class.h:3554
          #2 0x5608dace9476 in sp_head::execute_trigger(THD*, st_mysql_lex_string const*, st_mysql_lex_string const*, st_grant_info*) /data/src/10.1/sql/sp_head.cc:1742
          #3 0x5608db03aac5 in Table_triggers_list::process_triggers(THD*, trg_event_type, trg_action_time_type, bool) /data/src/10.1/sql/sql_trigger.cc:2205
          #4 0x5608dad80b9d in fill_record_n_invoke_before_triggers(THD*, TABLE*, List<Item>&, List<Item>&, bool, trg_event_type) /data/src/10.1/sql/sql_base.cc:9013
          #5 0x5608dae0f99f in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) /data/src/10.1/sql/sql_insert.cc:939
          #6 0x5608dae635b0 in mysql_execute_command(THD*) /data/src/10.1/sql/sql_parse.cc:3658
          #7 0x5608dae72424 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.1/sql/sql_parse.cc:7200
          #8 0x5608dae792d4 in dispatch_command(enum_server_command, THD*, char*, unsigned int) /data/src/10.1/sql/sql_parse.cc:1491
          #9 0x5608dae7e663 in do_command(THD*) /data/src/10.1/sql/sql_parse.cc:1123
          #10 0x5608db125c65 in do_handle_one_connection(THD*) /data/src/10.1/sql/sql_connect.cc:1331
          #11 0x5608db126221 in handle_one_connection /data/src/10.1/sql/sql_connect.cc:1242
          #12 0x5608dba606ac in pfs_spawn_thread /data/src/10.1/storage/perfschema/pfs.cc:1868
          #13 0x7f523b01b4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #14 0x7f5239829d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      0x6250000deb68 is located 616 bytes inside of 8268-byte region [0x6250000de900,0x6250000e094c)
      freed by thread T6 here:
          #0 0x7f523b2f2a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
          #1 0x5608dc10a215 in free_memory /data/src/10.1/mysys/safemalloc.c:276
       
      previously allocated by thread T6 here:
          #0 0x7f523b2f2d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x5608dc10a3b9 in sf_malloc /data/src/10.1/mysys/safemalloc.c:115
          #2 0x5608dc2674f2  (/data/bld/10.1-asan/bin/mysqld+0x1dd24f2)
       
      Thread T6 created by T0 here:
          #0 0x7f523b261f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x5608dba6c030 in spawn_thread_v1 /data/src/10.1/storage/perfschema/pfs.cc:1918
       
      SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.1/sql/sql_class.cc:1952 in THD::killed_errno()
      Shadow bytes around the buggy address:
        0x0c4a80013d10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c4a80013d20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013d30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013d40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013d50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      =>0x0c4a80013d60: fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd
        0x0c4a80013d70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013d80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013d90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013da0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c4a80013db0: 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
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==23951==ABORTING
      

      10.1 f73db933 debug

      CURRENT_TEST: bug.kill1
      mysqltest: At line 6: query 'INSERT INTO t1 () VALUES ()' failed: 36751: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            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.