[MDEV-27835] innochecksum -S crashes for encrypted .ibd tablespace Created: 2022-02-14  Updated: 2022-05-04  Resolved: 2022-03-29

Status: Closed
Project: MariaDB Server
Component/s: Encryption, Scripts & Clients, Storage Engine - InnoDB
Affects Version/s: 10.2.27, 10.5.16
Fix Version/s: 10.2.44, 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3, 10.9.1

Type: Bug Priority: Critical
Reporter: Valerii Kravchuk Assignee: Vladislav Lesin
Resolution: Fixed Votes: 0
Labels: innochecksum


 Description   

We need a way to get summary of pages by type for the encrypted .ibd file.

Now we get a crash like this when trying to gte this information for encrypted .ibd file with 10.2.27, for example:

 
# gdb --args /path/bin/innochecksum -S t.ibd
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /path/bin/innochecksum...done.
(gdb) r
Starting program: /path/bin/innochecksum -S t.ibd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
 
Program received signal SIGSEGV, Segmentation fault.
0x00007f4a7aebc28b in __fprintf_chk () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install ...
(gdb) bt
#0 0x00007f4a7aebc28b in __fprintf_chk () from /lib64/libc.so.6
#1 0x00005599d7a2fbcb in fprintf (__fmt=0x5599d7a77998 "#::%llu\t\t|\t\tEncrypted Index page\t\t\t|\tkey_version %u,%s\n", __stream=0x0) at /usr/include/bits/stdio2.h:99
#2 parse_page (page=page@entry=0x5599d82f0000 "\273\066\314", <incomplete sequence \303>, xdes=xdes@entry=0x7f4a7bfa0000 "\253V\306e", file=file@entry=0x0, page_size=...,
is_encrypted=is_encrypted@entry=true) at /home/buildbot/buildbot/build/extra/innochecksum.cc:944
#3 0x00005599d7a2d28c in main (argc=1, argv=0x7ffceb958640) at /home/buildbot/buildbot/build/extra/innochecksum.cc:2018
(gdb) 



 Comments   
Comment by Valerii Kravchuk [ 2022-02-21 ]

Yes, create any encrypted InnoDB table t, add some data and then stop the instance and run innochecksum -S /path/to/t.ibd, check the results.

Comment by Marko Mäkelä [ 2022-03-02 ]

I can repeat this with the following change to an existing test:

diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test
index 5423a70f5d9..79a8bbabe2b 100644
--- a/mysql-test/suite/encryption/t/innochecksum.test
+++ b/mysql-test/suite/encryption/t/innochecksum.test
@@ -70,7 +70,7 @@ shutdown_server;
 
 --echo # Run innochecksum on t1
 -- disable_result_log
---exec $INNOCHECKSUM $t1_IBD
+--exec $INNOCHECKSUM -S $t1_IBD
 
 --echo # Run innochecksum on t2
 

10.2 3fd79a04b69af46eddcdef947bef07b4c139ac75

CURRENT_TEST: encryption.innochecksum
mysqltest: At line 73: exec of '/dev/shm/10.2o/extra/innochecksum -S /dev/shm/10.2o/mysql-test/var/mysqld.1/data//test/t1.ibd 2>&1' failed, error: 35584, status: 139, errno: 32
Output from before failure:
Segmentation fault

Comment by Valerii Kravchuk [ 2022-03-15 ]

Repeatable the same way as Marko explained with current 10.5.16 from GitHub:

Yuliyas-MacBook-Air:mysql-test Valerii$ pwd
/Users/Valerii/dbs/maria10.5/mysql-test
Yuliyas-MacBook-Air:mysql-test Valerii$ ./mtr encryption.innochecksum
Logging: ./mtr  encryption.innochecksum
VS config: 
vardir: /Users/Valerii/dbs/maria10.5/mysql-test/var
Removing old var directory...
Creating var directory '/Users/Valerii/dbs/maria10.5/mysql-test/var'...
Checking supported features...
MariaDB Version 10.5.16-MariaDB
 - SSL connections supported
 - binaries built with wsrep patch
Collecting tests...
Installing system database...
 
==============================================================================
 
TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
encryption.innochecksum '16k,cbc,crc32,innodb' [ fail ]
        Test ended at 2022-03-15 19:43:39
 
CURRENT_TEST: encryption.innochecksum
sh: line 1: 51763 Segmentation fault: 11  /Users/Valerii/dbs/maria10.5/bin/innochecksum -S /Users/Valerii/dbs/maria10.5/mysql-test/var/mysqld.1/data//test/t1.ibd 2>&1
mysqltest: At line 63: exec of '/Users/Valerii/dbs/maria10.5/bin/innochecksum -S /Users/Valerii/dbs/maria10.5/mysql-test/var/mysqld.1/data//test/t1.ibd 2>&1' failed, error: 35584, status: 139, errno: 22
Output from before failure:
# Run innochecksum on t1
...

Generated at Thu Feb 08 09:55:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.