[MDEV-13253] After rebuilding redo logs, InnoDB can leak data from redo log buffer Created: 2017-07-06 Updated: 2017-09-07 Resolved: 2017-09-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.2 |
| Fix Version/s: | 10.0.33, 10.1.27, 10.2.9, 10.3.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
|
| Comments |
| Comment by Marko Mäkelä [ 2017-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
The linked Buildbot logs do not seem to be available any more. For encryption.innodb_encrypt_log, I have good news. I was able to reproduce a failure locally, with this type of result difference:
With painstaking analysis, I determined that the offending clear-text redo log block is at the end of the redo log, as indicated by the LOG_BLOCK_HDR_DATA_LEN field that contains 0x26, meaning that the block should end at file offset 0x5c26:
When writing redo log, InnoDB should zero out the garbage to avoid information leaks like this. This data is encrypted in the data files, and it was originally encrypted in the redo log. The data got exposed after redo log encryption was disabled and some other data was redo-logged. The other data must be found clear-text in the new unencrypted redo log, but there is absolutely no reason to write any old (originally encrypted) recovered redo log records there. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
The fix is simple. After applying the fix to log_block_init() only, 4×20 repeats of the test encryption.innodb_encrypt_log passed for me. The change to recv_reset_logs() is extra safety, in case redo log is being written in larger blocks than 512 bytes.
| ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Before | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2017-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
I do not see any easy way to avoid these memsets when not needed, and hopefully they do not have significant effect on performance especially when encryption is not enabled. ok to push. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-09-07 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
The main performance impact should be in log_write_low(). Unfortunately, that is being executed while holding the log_sys->mutex. |