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

MariaDB UAP issue

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.9.0
    • N/A
    • N/A
    • None
    • Linux jie-2 5.4.143-1-pve #1 SMP PVE 5.4.143-1 (Tue, 28 Sep 2021 09:10:37 +0200) x86_64 x86_64 x86_64 GNU/Linux

    Description

      PoC:

      CREATE TABLE v0 ( v2 INT , v1 NUMERIC ) ;
       CREATE INDEX END ON v0 ( v0 ) ;
       CREATE TABLE v3 ( v5 INT , v4 FLOAT KEY CHECK ( ( v5 = 'x' AND 'x' BETWEEN 'x' AND lower ( 'x' * 'x' ) NOT IN ( 83670243.000000 ) ) ) ) ;
       CREATE TRIGGER v3 BEFORE INSERT ON v0 FOR EACH ROW UPDATE v0 AS v0 JOIN v3 ON 'x' NATURAL JOIN v3 ONE SET v5 = -32768 ;
       INSERT INTO v0 VALUES ( 23 , -1 ) ;
       INSERT INTO v0 VALUES ( v2 IN ( 56 , 57 , 2147483647 , 127 ) , 31 ) ;
      

      report (compiled with ASAN):

      =================================================================
      ==9236==ERROR: AddressSanitizer: use-after-poison on address 0x6250000c38a0 at pc 0x000001009115 bp 0x7feb1a94a6b0 sp 0x7feb1a94a6a8
      READ of size 8 at 0x6250000c38a0 thread T14
          #0 0x1009114 in multi_update::prepare(List<Item>&, st_select_lex_unit*) /root/mariadb/sql/sql_update.cc:2160:5
          #1 0xd62ce3 in JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /root/mariadb/sql/sql_select.cc:1682:39
          #2 0xd4de93 in mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /root/mariadb/sql/sql_select.cc:4982:21
          #3 0x1006042 in mysql_multi_update(THD*, TABLE_LIST*, List<Item>*, List<Item>*, Item*, unsigned long long, enum_duplicates, bool, st_select_lex_unit*, st_select_lex*, multi_update**) /root/mariadb/sql/sql_update.cc:1968:8
          #4 0xc682e9 in mysql_execute_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:4486:12
          #5 0x9c6d83 in sp_instr_stmt::exec_core(THD*, unsigned int*) /root/mariadb/sql/sp_head.cc:3834:12
          #6 0x9c2ae1 in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /root/mariadb/sql/sp_head.cc:3560:17
          #7 0x9c4e8d in sp_instr_stmt::execute(THD*, unsigned int*) /root/mariadb/sql/sp_head.cc:3740:25
          #8 0x9a7f62 in sp_head::execute(THD*, bool) /root/mariadb/sql/sp_head.cc:1437:20
          #9 0x9ad212 in sp_head::execute_trigger(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, st_grant_info*) /root/mariadb/sql/sp_head.cc:1918:3
          #10 0xfa706c in Table_triggers_list::process_triggers(THD*, trg_event_type, trg_action_time_type, bool) /root/mariadb/sql/sql_trigger.cc:2469:22
          #11 0xab3ed4 in fill_record_n_invoke_before_triggers(THD*, TABLE*, Field**, List<Item>&, bool, trg_event_type) /root/mariadb/sql/sql_base.cc:8924:23
          #12 0xb68d89 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool, select_result*) /root/mariadb/sql/sql_insert.cc:1070:13
          #13 0xc68510 in mysql_execute_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:4562:10
          #14 0xc4a67e in mysql_parse(THD*, char*, unsigned int, Parser_state*) /root/mariadb/sql/sql_parse.cc:8027:18
          #15 0xc41ba9 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /root/mariadb/sql/sql_parse.cc:1894:7
          #16 0xc4b74b in do_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:1402:17
          #17 0x111f9f2 in do_handle_one_connection(CONNECT*, bool) /root/mariadb/sql/sql_connect.cc:1418:11
          #18 0x111f248 in handle_one_connection /root/mariadb/sql/sql_connect.cc:1312:5
          #19 0x1f3f9dd in pfs_spawn_thread /root/mariadb/storage/perfschema/pfs.cc:2201:3
          #20 0x7feb3f8f9608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
          #21 0x7feb3f60f162 in clone /build/glibc-sMfBJT/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
       
      0x6250000c38a0 is located 1952 bytes inside of 8208-byte region [0x6250000c3100,0x6250000c5110)
      allocated by thread T14 here:
          #0 0x80f99d in malloc (/usr/local/mysql/bin/mariadbd+0x80f99d)
          #1 0x2a76878 in my_malloc /root/mariadb/mysys/my_malloc.c:90:29
          #2 0x2a5887f in root_alloc /root/mariadb/mysys/my_alloc.c:66:10
          #3 0x2a5887f in alloc_root /root/mariadb/mysys/my_alloc.c:332:29
          #4 0xc4dc21 in Query_arena::memdup_w_gap(void const*, unsigned long, unsigned long) /root/mariadb/sql/sql_class.h:1228:9
          #5 0xc4dc21 in alloc_query(THD*, char const*, unsigned long) /root/mariadb/sql/sql_parse.cc:2727:30
          #6 0x9c41ee in sp_instr_stmt::execute(THD*, unsigned int*) /root/mariadb/sql/sp_head.cc:3727:14
          #7 0x9a7f62 in sp_head::execute(THD*, bool) /root/mariadb/sql/sp_head.cc:1437:20
          #8 0x9ad212 in sp_head::execute_trigger(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, st_grant_info*) /root/mariadb/sql/sp_head.cc:1918:3
          #9 0xfa706c in Table_triggers_list::process_triggers(THD*, trg_event_type, trg_action_time_type, bool) /root/mariadb/sql/sql_trigger.cc:2469:22
          #10 0xab3ed4 in fill_record_n_invoke_before_triggers(THD*, TABLE*, Field**, List<Item>&, bool, trg_event_type) /root/mariadb/sql/sql_base.cc:8924:23
          #11 0xb68d89 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool, select_result*) /root/mariadb/sql/sql_insert.cc:1070:13
          #12 0xc68510 in mysql_execute_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:4562:10
          #13 0xc4a67e in mysql_parse(THD*, char*, unsigned int, Parser_state*) /root/mariadb/sql/sql_parse.cc:8027:18
          #14 0xc41ba9 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /root/mariadb/sql/sql_parse.cc:1894:7
          #15 0xc4b74b in do_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:1402:17
          #16 0x111f9f2 in do_handle_one_connection(CONNECT*, bool) /root/mariadb/sql/sql_connect.cc:1418:11
          #17 0x111f248 in handle_one_connection /root/mariadb/sql/sql_connect.cc:1312:5
          #18 0x1f3f9dd in pfs_spawn_thread /root/mariadb/storage/perfschema/pfs.cc:2201:3
          #19 0x7feb3f8f9608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
       
      Thread T14 created by T0 here:
          #0 0x7f9cfc in pthread_create (/usr/local/mysql/bin/mariadbd+0x7f9cfc)
          #1 0x1f3fd39 in my_thread_create(unsigned long*, pthread_attr_t const*, void* (*)(void*), void*) /root/mariadb/storage/perfschema/my_thread.h:52:10
          #2 0x1f3fd39 in pfs_spawn_thread_v1 /root/mariadb/storage/perfschema/pfs.cc:2252:15
          #3 0x85cef4 in inline_mysql_thread_create(unsigned int, unsigned long*, pthread_attr_t const*, void* (*)(void*), void*) /root/mariadb/include/mysql/psi/mysql_thread.h:1139:11
          #4 0x85cef4 in create_thread_to_handle_connection(CONNECT*) /root/mariadb/sql/mysqld.cc:5975:19
          #5 0x85e72a in create_new_thread(CONNECT*) /root/mariadb/sql/mysqld.cc:6034:3
          #6 0x85e72a in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /root/mariadb/sql/mysqld.cc:6096:5
          #7 0x85a34c in handle_connections_sockets() /root/mariadb/sql/mysqld.cc:6220:9
          #8 0x84e9ef in mysqld_main(int, char**) /root/mariadb/sql/mysqld.cc:5870:3
          #9 0x7feb3f5140b2 in __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:308:16
       
      SUMMARY: AddressSanitizer: use-after-poison /root/mariadb/sql/sql_update.cc:2160:5 in multi_update::prepare(List<Item>&, st_select_lex_unit*)
      Shadow bytes around the buggy address:
        0x0c4a800106c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c4a800106d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c4a800106e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c4a800106f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c4a80010700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c4a80010710: 00 f7 f7 f7[f7]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4a80010720: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4a80010730: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4a80010740: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4a80010750: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c4a80010760: 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
      ==9236==ABORTING
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              fuboat Jingzhou Fu
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.