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

SIGSEGV in _ma_read_block_record2 | _ma_read_block_record | maria_rprev

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      MTR/CLI Compatible

      --source include/have_partition.inc
       
      CREATE TABLE t1 (c1 INT NOT NULL, c2 INT DEFAULT NULL, PRIMARY KEY (c1), KEY c2 (c2)) ENGINE=Aria PARTITION BY KEY (c1) PARTITIONS 2;
      INSERT INTO t1 (c1,c2) VALUES (1,1),(2,2);
      SELECT * FROM t1 USE INDEX (c2) WHERE c2 IS NOT NULL;
      HANDLER t1 OPEN;
      HANDLER t1 READ `PRIMARY`=(1);
      HANDLER t1 READ `PRIMARY` PREV;
      

      Leads to:

      CS 10.11.19 cea98ec09dd9a226047b09bc1f8516003b416e1c (Debug, Clang 18.1.3-11) Build 27/07/2026

      Core was generated by `/test/MD270726-mariadb-10.11.19-linux-x86_64-dbg/bin/mariadbd --no-defaults --l'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __memcpy_evex_unaligned_erms ()at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:323
       
      [Current thread is 1 (LWP 1879215)]
      (gdb) bt
      #0  __memcpy_evex_unaligned_erms ()at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:323
      #1  0x0000562a62b0df30 in _ma_read_block_record2 (info=0x6f8d48132b28, record=0xa5a5a5a5a5a5a5af <error: Cannot access memory at address 0xa5a5a5a5a5a5a5af>, data=0x6f8d481332d6 <incomplete sequence \374>, end_of_data=0x6f8d481332f7 "")at /test/10.11_dbg/storage/maria/ma_blockrec.c:4822
      #2  0x0000562a62b0f0fa in _ma_read_block_record (info=0x6f8d48132b28, record=0xa5a5a5a5a5a5a5af <error: Cannot access memory at address 0xa5a5a5a5a5a5a5af>, record_pos=256) at /test/10.11_dbg/storage/maria/ma_blockrec.c:5211
      #3  0x0000562a62b31254 in maria_rprev (info=0x6f8d48132b28, buf=0xa5a5a5a5a5a5a5af <error: Cannot access memory at address 0xa5a5a5a5a5a5a5af>, inx=0) at /test/10.11_dbg/storage/maria/ma_rprev.c:100
      #4  0x0000562a62aab703 in ha_maria::index_prev (this=0x6f8d480f8ed0, buf=0xa5a5a5a5a5a5a5af <error: Cannot access memory at address 0xa5a5a5a5a5a5a5af>) at /test/10.11_dbg/storage/maria/ha_maria.cc:2532
      #5  0x0000562a62815793 in handler::ha_index_prev (this=0x6f8d480f8ed0, buf=0xa5a5a5a5a5a5a5af <error: Cannot access memory at address 0xa5a5a5a5a5a5a5af>) at /test/10.11_dbg/sql/handler.cc:3744
      #6  0x0000562a62b77bb9 in ha_partition::handle_ordered_prev (this=0x6f8d480fc448, buf=0x6f8d4810d868 "\374\001")at /test/10.11_dbg/sql/ha_partition.cc:8490
      #7  0x0000562a62b77b2c in ha_partition::index_prev (this=0x6f8d480fc448, buf=0x6f8d4810d868 "\374\001") at /test/10.11_dbg/sql/ha_partition.cc:6334
      #8  0x0000562a62815793 in handler::ha_index_prev (this=0x6f8d480fc448, buf=0x6f8d4810d868 "\374\001") at /test/10.11_dbg/sql/handler.cc:3744
      #9  0x0000562a623cc359 in mysql_ha_read (thd=0x6f8d48000d58, tables=0x6f8d480135d8, mode=RPREV, keyname=0x6f8d48013d00 "PRIMARY", key_expr=0x6f8d48013d08, ha_rkey_mode=HA_READ_KEY_EXACT, cond=0x0, select_limit_cnt=1, offset_limit_cnt=0)at /test/10.11_dbg/sql/sql_handler.cc:937
      #10 0x0000562a6243353c in mysql_execute_command (thd=0x6f8d48000d58, is_called_from_prepared_stmt=false)at /test/10.11_dbg/sql/sql_parse.cc:5823
      #11 0x0000562a62422c84 in mysql_parse (thd=0x6f8d48000d58, rawbuf=0x6f8d48013480 "HANDLER t1 READ `PRIMARY` PREV", length=30, parser_state=0x778e238c6ae0) at /test/10.11_dbg/sql/sql_parse.cc:8219
      #12 0x0000562a624200d9 in dispatch_command (command=COM_QUERY, thd=0x6f8d48000d58, packet=0x6f8d4800af09 "", packet_length=30, blocking=true) at /test/10.11_dbg/sql/sql_parse.cc:1924
      #13 0x0000562a62423833 in do_command (thd=0x6f8d48000d58, blocking=true)at /test/10.11_dbg/sql/sql_parse.cc:1434
      #14 0x0000562a62602c29 in do_handle_one_connection (connect=0x562a950dd798, put_in_cache=true) at /test/10.11_dbg/sql/sql_connect.cc:1486
      #15 0x0000562a626029c2 in handle_one_connection (arg=0x562a951be958)at /test/10.11_dbg/sql/sql_connect.cc:1398
      #16 0x0000778e4a49cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #17 0x0000778e4a529d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed
      CS  10.6  dbg  310726  67ea07dd3400004e4f7ae01bf977f4344bbe064b  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      CS  10.6  opt  310726  67ea07dd3400004e4f7ae01bf977f4344bbe064b  No bug found
      CS  10.11  dbg  270726  cea98ec09dd9a226047b09bc1f8516003b416e1c  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      CS  10.11  opt  270726  0617cf2ab5fc37f49b25c22524c909f26069bd44  No bug found
      CS  11.4   dbg  290726  eccf9ca5f15bdca5b8e887396d9a570d580eb4ee  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      CS  11.4   opt  290726  eccf9ca5f15bdca5b8e887396d9a570d580eb4ee  No bug found
      CS  11.8   dbg  100726  666b2aca09cb84d59b4ece2185a9200d745cb287  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      CS  11.8   opt  100726  666b2aca09cb84d59b4ece2185a9200d745cb287  No bug found
      CS  12.3   dbg  100726  27df5668c2e3eef406a5357672d3d8e89d25ff48  No bug found
      CS  12.3   opt  100726  27df5668c2e3eef406a5357672d3d8e89d25ff48  No bug found
      CS  13.0   dbg  100726  84c246ca5387c0611f75097136ff4f4bea092aa3  No bug found
      CS  13.0   opt  100726  84c246ca5387c0611f75097136ff4f4bea092aa3  No bug found
      CS  13.1   dbg  230726  7b89d04911b8a618da9ed76536313a351977d41d  No bug found
      CS  13.1   opt  230726  7b89d04911b8a618da9ed76536313a351977d41d  No bug found
      ES  10.6   dbg  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      ES  10.6   opt  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found
      ES  11.4   dbg  060526  90f707057d44f1b5c013a0c3672fd12f32ea7085  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      ES  11.4   opt  060526  90f707057d44f1b5c013a0c3672fd12f32ea7085  No bug found
      ES  11.8   dbg  060526  1499789de285a8109d68d79347de0281865b28f4  SIGSEGV|_ma_read_block_record2|_ma_read_block_record|maria_rprev|ha_maria::index_prev
      ES  11.8   opt  060526  1499789de285a8109d68d79347de0281865b28f4  SIGSEGV|_ma_read_block_record2|maria_rprev|handler::ha_index_prev|ha_partition::handle_ordered_prev
      

      12.3+ build looks good

      12.3.3-dbg>HANDLER t1 READ `PRIMARY` PREV;
      Empty set (0.000 sec)
       
      12.3.3-dbg>
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.75h
                  0.75h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.