summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-01-17 13:09:14 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-01-17 13:10:45 +0530
commitad376a05fa3b817c05636bf9b36f40953c34bdfb (patch)
treed93b86414a99eb8a7f55d6bfc745e4334153c32d
parenta84be48e005ff5b77afca0d71ce3e4e851c87796 (diff)
downloadmariadb-git-ad376a05fa3b817c05636bf9b36f40953c34bdfb.tar.gz
MDEV-18279 MLOG_FILE_WRITE_CRYPT_DATA fails to set the crypt_data->type for tablespace.
Problem: ======== MLOG_FILE_WRITE_CRYPT_DATA redo log fails to apply type for the crypt_data present in the space. While processing the double-write buffer pages, page fails to decrypt. It leads to warning message. Fix: ==== Set the type while parsing MLOG_FILE_WRITE_CRYPT_DATA redo log. If type and length is of invalid type then mark it as corrupted.
-rw-r--r--storage/innobase/fil/fil0crypt.cc9
-rw-r--r--storage/xtradb/fil/fil0crypt.cc9
2 files changed, 12 insertions, 6 deletions
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index ded17736177..fb84b5703bf 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -529,10 +529,12 @@ fil_parse_write_crypt_data(
uint len = mach_read_from_1(ptr);
ptr += 1;
- ut_a(type == CRYPT_SCHEME_UNENCRYPTED ||
- type == CRYPT_SCHEME_1); // only supported
+ if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED)
+ || len != CRYPT_SCHEME_1_IV_LEN) {
+ *err = DB_CORRUPTION;
+ return NULL;
+ }
- ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported
uint min_key_version = mach_read_from_4(ptr);
ptr += 4;
@@ -551,6 +553,7 @@ fil_parse_write_crypt_data(
crypt_data->page0_offset = offset;
crypt_data->min_key_version = min_key_version;
crypt_data->encryption = encryption;
+ crypt_data->type = type;
memcpy(crypt_data->iv, ptr, len);
ptr += len;
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index ded17736177..fb84b5703bf 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -529,10 +529,12 @@ fil_parse_write_crypt_data(
uint len = mach_read_from_1(ptr);
ptr += 1;
- ut_a(type == CRYPT_SCHEME_UNENCRYPTED ||
- type == CRYPT_SCHEME_1); // only supported
+ if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED)
+ || len != CRYPT_SCHEME_1_IV_LEN) {
+ *err = DB_CORRUPTION;
+ return NULL;
+ }
- ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported
uint min_key_version = mach_read_from_4(ptr);
ptr += 4;
@@ -551,6 +553,7 @@ fil_parse_write_crypt_data(
crypt_data->page0_offset = offset;
crypt_data->min_key_version = min_key_version;
crypt_data->encryption = encryption;
+ crypt_data->type = type;
memcpy(crypt_data->iv, ptr, len);
ptr += len;