-
Notifications
You must be signed in to change notification settings - Fork 811
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
Work around UB in LMDB bindings #6211
Conversation
Thanks @jimmygchen for helping debug this. I'll have another follow-up PR that fixes the file descriptor leak in the iterated tests. I want to keep it separate from this PR because it involves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Nice, let's deploy this fix to our testnet slasher. |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 0bb2386 |
For reference, I think the exact type of UB triggered was:
From https://doc.rust-lang.org/reference/behavior-considered-undefined.html |
* Work around UB in LMDB bindings
* Work around UB in LMDB bindings
Issue Addressed
Fix a crazy memory corruption bug in the LMDB slasher impl.
Proposed Changes
Copy the contents of the cursor's
value
prior to returning it, so that LMDB can't mutate the data being pointed to when.delete_current()
is called.Additional Info
This possibly explains the strange behaviour seen on some slasher nodes:
The bug had existed latently for a long time, but only now became executable with the refactor in: