[MDEV-28798] Previously Binlog Encrypted Master Segfaults on Binlog Dump with Using_Gtid=Slave_Pos Created: 2022-06-10  Updated: 2023-04-25  Resolved: 2023-04-25

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 11.1.1, 10.11.3, 11.0.2, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Critical
Reporter: Brandon Nesterenko Assignee: Brandon Nesterenko
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-19801 Change defaults for CHANGE MASTER TO ... Closed

 Description   

A master can segfault if it can't set up decryption for its binary log during a binlog dump with Using_Gtid=Slave_Pos. Reproduction can be done by running binlog_encryption.encrypted_master_switch_to_unencrypted with the slave configured with Using_Gtid=Slave_Pos.

Initial analysis:
If slave connects using GTID mode, the master will call into log.cc::get_gtid_list_event(), which iterate through binlog events looking for a Gtid_list_log_event. On an encrypted binlog that the master cannot decrypt, the first event will be a START_ENCRYPTION_EVENT which will call into the following decryption branch

if (fdle->start_decryption((Start_encryption_log_event*) ev))
  errormsg= "Could not set up decryption for binlog.";

The event iteration however, does not stop in spite of this error. The master will try to read the next event, but segfault while trying to decrypt it because decryption failed to initialize.



 Comments   
Comment by Brandon Nesterenko [ 2022-09-28 ]

Howdy Andrei!

This is ready for review. PR-2282

Comment by Andrei Elkin [ 2023-04-17 ]

Thanks Brandon for a well written test too!

Comment by Brandon Nesterenko [ 2023-04-25 ]

Pushed into 10.4 as d3e7dba

A merge conflict is observed in 10.10 with resolution in branch 10.10-28798-merge

Generated at Thu Feb 08 10:03:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.