Ensure BPF read is 4-byte aligned#655
Merged
mrmonday merged 3 commits intolibpnet:mainfrom May 30, 2024
Merged
Conversation
Contributor
Author
|
|
Contributor
|
Is it possible to run that |
Contributor
|
Thanks! |
1 task
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.
Closes #641 and closes #645.
For pointer alignment,
buffer_offsetmust be a multiple of 4. If it is not, the program will panic like in #641 and #645. This PR roundsbuffer_offsetup to the nearest multiple of 4 to avoid this issue. This also requires increasing the size of the buffer to ensure there is enough room to read into. I have madebuffer_offseta member ofDataLinkReceiverImplas the allocation and use of the read buffer both require it, and previously it was derived twice in these two locations. By making it a member, it only needs to be derived once.This is pretty hacky code. As the FIXME in the file indicates, there are much better ways of getting around this. I think this would require breaking API changes however, and I am not familiar with the codebase. For now I think this hotfix is sufficient.