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

Server crashes in Prepared_statement::execute / mysql_open_cursor

    Details

      Description

      perl ./mtr main.connect --cursor-protocol
      

      10.0 4886d14827c

      #3  <signal handler called>
      #4  0x00000000009957ca in mysql_open_cursor (thd=0x7f7a38ea2070, result=0x7f7a377a1528, pcursor=0x7f7a377a1588) at /data/src/10.0/sql/sql_cursor.cc:183
      #5  0x0000000000670dfd in Prepared_statement::execute (this=0x7f7a377a1470, expanded_query=0x7f7a40c03550, open_cursor=true) at /data/src/10.0/sql/sql_prepare.cc:3955
      #6  0x000000000066ff7c in Prepared_statement::execute_loop (this=0x7f7a377a1470, expanded_query=0x7f7a40c03550, open_cursor=true, packet=0x7f7a3a3e507a "", packet_end=0x7f7a3a3e507a "") at /data/src/10.0/sql/sql_prepare.cc:3629
      #7  0x000000000066e01b in mysqld_stmt_execute (thd=0x7f7a38ea2070, packet_arg=0x7f7a3a3e5071 "\003", packet_length=9) at /data/src/10.0/sql/sql_prepare.cc:2724
      #8  0x000000000064aff2 in dispatch_command (command=COM_STMT_EXECUTE, thd=0x7f7a38ea2070, packet=0x7f7a3a3e5071 "\003", packet_length=9) at /data/src/10.0/sql/sql_parse.cc:1247
      #9  0x000000000064a5f0 in do_command (thd=0x7f7a38ea2070) at /data/src/10.0/sql/sql_parse.cc:1003
      #10 0x000000000076bf08 in do_handle_one_connection (thd_arg=0x7f7a38ea2070) at /data/src/10.0/sql/sql_connect.cc:1377
      #11 0x000000000076bc7a in handle_one_connection (arg=0x7f7a38ea2070) at /data/src/10.0/sql/sql_connect.cc:1292
      #12 0x0000000000acdb54 in pfs_spawn_thread (arg=0x7f7a38da2370) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #13 0x00007f7a40837494 in start_thread (arg=0x7f7a40c04700) at pthread_create.c:333
      #14 0x00007f7a3ee0b93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      bb-10.2-compatibility ASAN 025aee64e03

      ==29287==ERROR: AddressSanitizer: use-after-poison on address 0x62b0000003a0 at pc 0x5636fb1a960e bp 0x7f6e4b6617a0 sp 0x7f6e4b661798
      READ of size 8 at 0x62b0000003a0 thread T5
          #0 0x5636fb1a960d in mysql_open_cursor(THD*, select_result*, Server_side_cursor**) /data/src/bb-10.2-compatibility/sql/sql_cursor.cc:177
          #1 0x5636fb2aec3d in Prepared_statement::execute(String*, bool) /data/src/bb-10.2-compatibility/sql/sql_prepare.cc:4722
          #2 0x5636fb2aa715 in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /data/src/bb-10.2-compatibility/sql/sql_prepare.cc:4172
          #3 0x5636fb2a4b4b in mysql_stmt_execute_common /data/src/bb-10.2-compatibility/sql/sql_prepare.cc:3170
          #4 0x5636fb2a43e9 in mysqld_stmt_execute(THD*, char*, unsigned int) /data/src/bb-10.2-compatibility/sql/sql_prepare.cc:3068
          #5 0x5636fb241c6c in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.2-compatibility/sql/sql_parse.cc:1777
          #6 0x5636fb23f16c in do_command(THD*) /data/src/bb-10.2-compatibility/sql/sql_parse.cc:1383
          #7 0x5636fb583283 in do_handle_one_connection(CONNECT*) /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1335
          #8 0x5636fb582c98 in handle_one_connection /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1241
          #9 0x5636fc00a12f in pfs_spawn_thread /data/src/bb-10.2-compatibility/storage/perfschema/pfs.cc:1862
          #10 0x7f6e57c27493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
          #11 0x7f6e5600d93e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
       
      0x62b0000003a0 is located 416 bytes inside of 24716-byte region [0x62b000000200,0x62b00000628c)
      allocated by thread T5 here:
          #0 0x7f6e57e9173f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x5636fc941027 in sf_malloc /data/src/bb-10.2-compatibility/mysys/safemalloc.c:118
          #2 0x5636fc91009d in my_malloc /data/src/bb-10.2-compatibility/mysys/my_malloc.c:101
          #3 0x5636fc8f041b in reset_root_defaults /data/src/bb-10.2-compatibility/mysys/my_alloc.c:151
          #4 0x5636fb178d41 in THD::init_for_queries() /data/src/bb-10.2-compatibility/sql/sql_class.cc:1444
          #5 0x5636fb582655 in prepare_new_connection_state(THD*) /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1172
          #6 0x5636fb582cde in thd_prepare_connection(THD*) /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1256
          #7 0x5636fb583259 in do_handle_one_connection(CONNECT*) /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1326
          #8 0x5636fb582c98 in handle_one_connection /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1241
          #9 0x5636fc00a12f in pfs_spawn_thread /data/src/bb-10.2-compatibility/storage/perfschema/pfs.cc:1862
          #10 0x7f6e57c27493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
       
      Thread T5 created by T0 here:
          #0 0x7f6e57e60bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
          #1 0x5636fc00a6f7 in spawn_thread_v1 /data/src/bb-10.2-compatibility/storage/perfschema/pfs.cc:1912
          #2 0x5636fafe15ae in inline_mysql_thread_create /data/src/bb-10.2-compatibility/include/mysql/psi/mysql_thread.h:1239
          #3 0x5636faff6509 in create_thread_to_handle_connection(CONNECT*) /data/src/bb-10.2-compatibility/sql/mysqld.cc:6457
          #4 0x5636faff6c0e in create_new_thread /data/src/bb-10.2-compatibility/sql/mysqld.cc:6527
          #5 0x5636faff7c1f in handle_connections_sockets() /data/src/bb-10.2-compatibility/sql/mysqld.cc:6802
          #6 0x5636faff5a56 in mysqld_main(int, char**) /data/src/bb-10.2-compatibility/sql/mysqld.cc:6076
          #7 0x5636fafdf94f in main /data/src/bb-10.2-compatibility/sql/main.cc:25
          #8 0x7f6e55f452b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
       
      SUMMARY: AddressSanitizer: use-after-poison /data/src/bb-10.2-compatibility/sql/sql_cursor.cc:177 mysql_open_cursor(THD*, select_result*, Server_side_cursor**)
      Shadow bytes around the buggy address:
        0x0c567fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c567fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c567fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff8050: 00 00 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c567fff8060: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
      =>0x0c567fff8070: f7 f7 f7 f7[f7]00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff80b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c567fff80c0: 00 00 00 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
        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
      ==29287==ABORTING
      

        Attachments

          Activity

            People

            • Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: