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

MariaDB UAP issue

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.9.0
    • Fix Version/s: N/A
    • Component/s: N/A
    • Labels:
      None
    • Environment:
      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:

      SELECT '' IS NULL , -2147483648 IS NULL , 28 IS NOT NULL , 28 IS NOT NULL ;
      CREATE TABLE v0 ( v1 CHAR PRIMARY KEY ) ;
      CREATE TABLE v2 ( v4 INT NOT NULL , v3 INT NOT NULL ) ;
      ALTER TABLE v0 ADD COLUMN ( MEMORY BIGINT DEFAULT ( ( CASE 'x' 'x' WHEN 17 THEN ( 'x' * 'x' * 'x' * 16 ) END ) BETWEEN 96 AND ( 'x' XOR CURRENT_USER ) ) ) ;
      CREATE TABLE v5 AS SELECT '' AS v6 ;
      DELETE IGNORE FROM v0 WHERE -1 + 81 + 81 IS NOT NULL ORDER BY v1 LIMIT 83 ;
      SELECT * FROM v5 WHERE '' ORDER BY v6 DESC LIMIT 0 ;
      DELETE FROM v0 WHERE DAY ( ( 'x' OR 'x' 'x' ) * 0 NOT IN ( NULL , '' , '' ) ) OR 'x' ;
      

      report (compiled with ASAN):

      =================================================================
      ==7588==ERROR: AddressSanitizer: use-after-poison on address 0x6290000922d0 at pc 0x0000016e7cf5 bp 0x7f4e8d667730 sp 0x7f4e8d667728
      READ of size 8 at 0x6290000922d0 thread T16
          #0 0x16e7cf4 in Item_cond::fix_fields(THD*, Item**) /root/mariadb/sql/item_cmpfunc.cc:4869:18
          #1 0xab0b54 in Item::fix_fields_if_needed(THD*, Item**) /root/mariadb/sql/item.h:1144:30
          #2 0xab0b54 in Item::fix_fields_if_needed_for_scalar(THD*, Item**) /root/mariadb/sql/item.h:1148:12
          #3 0xab0b54 in Item::fix_fields_if_needed_for_bool(THD*, Item**) /root/mariadb/sql/item.h:1152:12
          #4 0xab0b54 in setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**) /root/mariadb/sql/sql_base.cc:8474:19
          #5 0xb433d7 in mysql_prepare_delete(THD*, TABLE_LIST*, Item**, bool*) /root/mariadb/sql/sql_delete.cc:1062:7
          #6 0xb3991f in mysql_delete(THD*, TABLE_LIST*, Item*, SQL_I_List<st_order>*, unsigned long long, unsigned long long, select_result*) /root/mariadb/sql/sql_delete.cc:371:7
          #7 0xc69ee7 in mysql_execute_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:4804:11
          #8 0xc4a67e in mysql_parse(THD*, char*, unsigned int, Parser_state*) /root/mariadb/sql/sql_parse.cc:8027:18
          #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 0x7f4eb3645608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
          #15 0x7f4eb335b162 in clone /build/glibc-sMfBJT/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
       
      0x6290000922d0 is located 4304 bytes inside of 16400-byte region [0x629000091200,0x629000095210)
      allocated by thread T16 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 0x7f4eb3645608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
       
      Thread T16 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 0x7f4eb32600b2 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/item_cmpfunc.cc:4869:18 in Item_cond::fix_fields(THD*, Item**)
      Shadow bytes around the buggy address:
        0x0c528000a400: 00 00 00 f7 00 00 f7 00 00 f7 00 00 f7 00 00 00
        0x0c528000a410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c528000a420: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00
        0x0c528000a430: 00 00 f7 00 00 00 00 f7 00 00 00 00 00 00 00 00
        0x0c528000a440: 00 f7 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c528000a450: 00 00 00 00 00 00 00 f7 02 f7[f7]f7 f7 f7 f7 f7
        0x0c528000a460: f7 f7 f7 f7 f7 f7 f7 f7 f7 04 f7 00 00 00 00 00
        0x0c528000a470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c528000a480: 00 00 00 00 00 f7 00 00 f7 00 00 f7 00 00 00 00
        0x0c528000a490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c528000a4a0: f7 00 00 00 00 00 00 00 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
      ==7588==ABORTING
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              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.