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

Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys

    XMLWordPrintable

    Details

    • Sprint:
      10.1.8-1

      Description

      • Create encrypted table using some keys
      • Restart server using different keys
      • Check table

      Stack:

      Thread 1 (Thread 0x7f7e800d7700 (LWP 22594)):
      #0  0x00007f7e8f301101 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
      #1  0x00007f7e9046000c in my_write_core (sig=6) at /home/jan/mysql/10.1-tmp/mysys/stacktrace.c:456
      #2  0x00007f7e8fe0b72f in handle_fatal_signal (sig=6) at /home/jan/mysql/10.1-tmp/sql/signal_handler.cc:273
      #3  <signal handler called>
      #4  0x00007f7e8ce37107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
      #5  0x00007f7e8ce384e8 in __GI_abort () at abort.c:89
      #6  0x00007f7e880b43a3 in btr_page_get_level_low (page=0x0) at /home/jan/mysql/10.1-tmp/storage/innobase/include/btr0btr.ic:122
      #7  0x00007f7e880bf26f in btr_validate_index (index=0x7f7e4c135bb8, trx=0x7f7e4c1351c8) at /home/jan/mysql/10.1-tmp/storage/innobase/btr/btr0btr.cc:5148
      #8  0x00007f7e881cfb68 in ha_innodb::check (this=0x7f7e4c13f258, thd=0x7f7e92dc22e0, check_opt=0x7f7e92dc6ae0) at /home/jan/mysql/10.1-tmp/storage/innobase/handler/ha_innodb.cc:13510
      #9  0x00007f7e8fe150e5 in handler::ha_check (this=0x7f7e4c13f258, thd=0x7f7e92dc22e0, check_opt=0x7f7e92dc6ae0) at /home/jan/mysql/10.1-tmp/sql/handler.cc:3923
      #10 0x00007f7e8fd1e273 in mysql_admin_table(THD *, TABLE_LIST *, HA_CHECK_OPT *, const char *, thr_lock_type, bool, bool, uint, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *), struct {...}, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *)) (thd=0x7f7e92dc22e0, tables=0x7f7e4c013b20, check_opt=0x7f7e92dc6ae0, operator_name=0x7f7e90554f54 "check", lock_type=TL_READ_NO_INSERT, open_for_modify=false, repair_table_use_frm=false, extra_open_options=32, prepare_func=0x0, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x7f7e8fe14fc0 <handler::ha_check(THD*, st_ha_check_opt*)>, view_operator_func=0x7f7e8fcc2507 <view_check(THD*, TABLE_LIST*, st_ha_check_opt*)>) at /home/jan/mysql/10.1-tmp/sql/sql_admin.cc:750
      #11 0x00007f7e8fd1fe2f in Sql_cmd_check_table::execute (this=0x7f7e4c014108, thd=0x7f7e92dc22e0) at /home/jan/mysql/10.1-tmp/sql/sql_admin.cc:1220
      #12 0x00007f7e8fbe8500 in mysql_execute_command (thd=0x7f7e92dc22e0) at /home/jan/mysql/10.1-tmp/sql/sql_parse.cc:5624
      #13 0x00007f7e8fbec613 in mysql_parse (thd=0x7f7e92dc22e0, rawbuf=0x7f7e4c013a58 "CHECK TABLE t1", length=14, parser_state=0x7f7e800d6230) at /home/jan/mysql/10.1-tmp/sql/sql_parse.cc:7227
      #14 0x00007f7e8fbdb612 in dispatch_command (command=COM_QUERY, thd=0x7f7e92dc22e0, packet=0x7f7e92dc8cc1 "", packet_length=14) at /home/jan/mysql/10.1-tmp/sql/sql_parse.cc:1488
      #15 0x00007f7e8fbda348 in do_command (thd=0x7f7e92dc22e0) at /home/jan/mysql/10.1-tmp/sql/sql_parse.cc:1110
      #16 0x00007f7e8fd0cf72 in do_handle_one_connection (thd_arg=0x7f7e92dc22e0) at /home/jan/mysql/10.1-tmp/sql/sql_connect.cc:1350
      #17 0x00007f7e8fd0ccd6 in handle_one_connection (arg=0x7f7e92dc22e0) at /home/jan/mysql/10.1-tmp/sql/sql_connect.cc:1262
      #18 0x00007f7e8ffeecf6 in pfs_spawn_thread (arg=0x7f7e92dcde50) at /home/jan/mysql/10.1-tmp/storage/perfschema/pfs.cc:1860
      #19 0x00007f7e8f2fc0a4 in start_thread (arg=0x7f7e800d7700) at pthread_create.c:309
      #20 0x00007f7e8cee804d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

      Test case:

      --source include/have_innodb.inc
      # embedded does not support restart
      -- source include/not_embedded.inc
      -- source include/not_valgrind.inc
      # Avoid CrashReporter popup on Mac
      -- source include/not_crashrep.inc
      #
      # MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
      #
      call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
      call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
      call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
      call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
      call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
      # Suppression for builds where file_key_management plugin is linked statically
      call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
       
      --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --shutdown_server
      --source include/wait_until_disconnected.inc
       
      --write_file $MYSQLTEST_VARDIR/keys1.txt
      1;770A8A65DA156D24EE2A093277530142
      4;770A8A65DA156D24EE2A093277530143
      EOF
       
      --exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      --let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
      --let $MYSQLD_DATADIR = `SELECT @@datadir`
       
      --disable_query_log
      let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
      let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
      --enable_query_log
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
      INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
       
      --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --shutdown_server
      --source include/wait_until_disconnected.inc
       
      --write_file $MYSQLTEST_VARDIR/keys2.txt
      1;770A8A65DA156D24EE2A093277530142
      4;770A8A65DA156D24EE2A093277530144
      EOF
       
      --exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
       
      CHECK TABLE t1;
       
      --remove_file $MYSQLTEST_VARDIR/keys1.txt
      --remove_file $MYSQLTEST_VARDIR/keys2.txt
       
      # reset system
      --disable_query_log
      EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
      EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
      --enable_query_log

        Attachments

          Activity

            People

            Assignee:
            jplindst Jan Lindström
            Reporter:
            jplindst Jan Lindström
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration