Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS-4561: Read after free at Binlog_crypt_data::load_latest_binlog_key() #2468

Merged
merged 1 commit into from
Aug 16, 2018

Conversation

robgolebiowski
Copy link
Contributor

Removed access to system_key after it was freed. Also initliazed nonce
to 0s.

@robgolebiowski
Copy link
Contributor Author

https://jenkins.percona.com/job/mysql-5.7-valgrind-param/97/
Tests rpl_encryption.encrypted_slave rpl_encryption.encrypted_master are failing due to timeouts.

sql/binlog.cc Outdated
if (my_rand_buffer(nonce, sizeof(nonce)))
goto err;

// Check that after my_rand_buffer nonce does not contain all zeroes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this check is useful: it's supposed to be an extremely rare occurrence. If it happens on a production server, debug check will not help, if it happens on a debug build, it's non-actionable. An option would be to generate a random not-zero byte and poke it somewhere, but this changes PRNG properties, and I'm not sure if for the better. What's the textbook standard way of dealing with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to be extra sure that after initializing nonce with 0 and then running my_rand_buffer on it - it for sure will be initialized with random bytes ... more like a sanity check. But when I look at it now I think I was bit over paranoid. I am OK with removing this check. Should I ? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please remove

Removed access to system_key after it was freed. Also initliazed nonce
to 0s.
@robgolebiowski
Copy link
Contributor Author

@robgolebiowski robgolebiowski merged commit ffa88a0 into percona:5.7 Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants