-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3707] A workaround for encryption counter overflow
Summary: This is a workaround for the encrypted file corruption issue described at #3707. When reading a block from an encrypted SSTable and getting a checksum mismatch, we now try to increment byte 11 of the initialization vector (carrying over into earlier bytes when encountering 0xff) and decrypt and verify checksum once again. Similarly, when reading an SSTable footer, we use magic number comparison instead of checksum verification. This workaround is turned on by default and is controlled using the new `--encryption_counter_overflow_read_path_workaround` flag. This diff is not fixing the underlying ignored overflow issue yet. While it would be easy to do so, the old read path would not be able to read files written with the new write path. Instead, we will deploy this workaround, disable encryption, perform major compactions on all data, and then deploy the real fix and re-enable encryption. Also we restrict the range of the unsigned 32-bit randomly-generated initial counter value to [0, 0x7fffffff] by default. This reduces the effective key size by 1 bit but eliminates the overflow issue for all files up to 32 GiB in size. This range could be customized using the new flags: `--encryption_counter_min` and `--encryption_counter_max` (both of these bounds are inclusive). Also avoid storing a reference to a shared pointer in TableReaderOptions. This fixes an ASAN issue in the new test. Test Plan: Jenkins New test, encrypted_sstable-test, that fails without the fix and passes with the fix. Reviewers: rahuldesirazu, kannan, sergei, bogdan Reviewed By: sergei Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D8020
- Loading branch information
1 parent
699ca2c
commit 68d78d0
Showing
23 changed files
with
709 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.