Fix out-of-bound access when resizing in receive_spill - #18861
Open
tuxoko wants to merge 1 commit into
Open
Conversation
receive_spill will call dbuf_spill_set_blksz, which in turn calls dbuf_new_size when resizing spill block. However, receive_spill holds a raw buf, which can be compressed and less than db_size. This causes an out-of-bound access when dbuf_new_size tries to copy the data using db_size as length. To fix this, we just disable the copy when coming from receive_spill, since we will assign a new arc_buf later anyway. Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Contributor
Author
|
found in #18854 (comment) |
Member
|
I have a subtle feeling this is a dirty workaround. IIRC dbuf layer was never really designed to mix raw and uncompressed buffers, and I wonder if the problem can actually be in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
receive_spill will call dbuf_spill_set_blksz, which in turn calls dbuf_new_size when resizing spill block. However, receive_spill holds a raw buf, which can be compressed and less than db_size. This causes an out-of-bound access when dbuf_new_size tries to copy the data using db_size as length.
To fix this, we just disable the copy when coming from receive_spill, since we will assign a new arc_buf later anyway.
Motivation and Context
Description
How Has This Been Tested?
Types of Changes
Checklist
Signed-off-by.