-
Notifications
You must be signed in to change notification settings - Fork 1.9k
BRT: Fix ranges to blocks conversion math #17915
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
Conversation
BRT_RANGESIZE_TO_NBLOCKS() takes number of ranges as its argument. To get number of blocks we should multiply it by the entry size, not divide by it, as it was due to missing parentheses. Before openzfs#17875 this could cause small memory corruptions for vdevs bigger than 64TB, but the change made the bug more noticeable. Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
|
That looks right, though I don't feel qualified to give it a review+. |
|
Also @robn should be aware though they probably are :) |
behlendorf
left a comment
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.
Looks good. As you said, it seems this issue has been lurking for a while but hidden by the allocator. It'd be nice to add a KASAN builder to help catch this kind of thing, but I'm not aware of any distro debug kernels which ship with it enabled. We used to build our own kernel for this but it was quite the hassle to maintain.
|
@behlendorf Hey there, sorry to go off-topic here - but could you tell me what you would need for that KASAN integration (and any documentation you have at previous attempts at this?)? I have found: https://docs.kernel.org/dev-tools/kasan.html I can look into coupling https://nixcademy.com/posts/nixos-integration-tests/ with https://uninsane.org/blog/nixos-kernel-hacking/ to automate the building of kernels + virtual machines for testing for this. There's also https://wiki.nixos.org/wiki/Kernel_Debugging_with_QEMU . But I do not know what requirements you have for this beyond |
BRT_RANGESIZE_TO_NBLOCKS() takes number of ranges as its argument. To get number of blocks we should multiply it by the entry size, not divide by it, as it was due to missing parentheses. Before openzfs#17875 this could cause small memory corruptions for vdevs bigger than 64TB, but the change made the bug more noticeable. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes openzfs#17886 Closes openzfs#17915
BRT_RANGESIZE_TO_NBLOCKS() takes number of ranges as its argument. To get number of blocks we should multiply it by the entry size, not divide by it, as it was due to missing parentheses. Before openzfs#17875 this could cause small memory corruptions for vdevs bigger than 64TB, but the change made the bug more noticeable. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes openzfs#17886 Closes openzfs#17915
|
That's very interesting. When we've set this up in the past the biggest issue was definitely automating and maintaining the building of a debug kernel configured with the
I'd think NixOS would work fine for this. We'd have to add any distribution specific knowledge to our CI scripts, but they're already setup to be extended so it should be straight forward. We just need to recipe. We're in a much better place on the CI front now that everything is run via GitHub actions. As for the kernel config, I'd start with enabling these checkers. We'd have to see if performance is tolerable with all of the additional checking, and then tweak as needed.
Does that sound reasonable? |
BRT_RANGESIZE_TO_NBLOCKS() takes number of ranges as its argument. To get number of blocks we should multiply it by the entry size, not divide by it, as it was due to missing parentheses. Before openzfs#17875 this could cause small memory corruptions for vdevs bigger than 64TB, but the change made the bug more noticeable. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes openzfs#17886 Closes openzfs#17915
BRT_RANGESIZE_TO_NBLOCKS()takes number of ranges as its argument. To get number of blocks we should multiply it by the entry size, not divide by it, as it was due to missing parentheses.Before #17875 this could cause small memory corruptions for vdevs bigger than 64TB+, depending on kernel's smallest memory allocation unit, but the change made the bug more noticeable.
Fixes #17886
How Has This Been Tested?
Not really.
Types of changes
Checklist:
Signed-off-by.