bufpool: check for buffer overruns, idm: add callback to handle cleanup#6577
Merged
shefty merged 3 commits intoofiwg:masterfrom Feb 19, 2021
Merged
bufpool: check for buffer overruns, idm: add callback to handle cleanup#6577shefty merged 3 commits intoofiwg:masterfrom
shefty merged 3 commits intoofiwg:masterfrom
Conversation
added 2 commits
February 18, 2021 18:13
Provide a callback for any items stored in the index map when it is reset. This allows users to free structures which may only be stored in the index map. This fixes ASAN errors when using rxd by freeing peer endpoint data. Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Introduce macros that can be used to easily define variables or fields that should only exist in debug builds. These macros replace ifdef's in the code and are expected to be paired with assert checks. Update a couple of places where debug fields are defined to use the macros. Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Member
Author
|
Hmm... the changes break all windows release builds. The macros must not work there. Investigating. |
Member
Author
|
It looks like the windows build doesn't like an extra ';' floating in the middle of a struct. |
Add magic values to verify that users do not access buffers outside of the exposed areas. Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Member
Author
|
bot:aws:retest |
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.
The rxd provider allocates and stores a data structure in an index map. Although the map is reset during cleanup, the allocated structures are lost, resulting in a memory leak. The latter usually only happens during application exit, but does show up using ASAN. Add a callback when resetting the idm, so that the structures can be freed.
Enhance the buffer pool to wrap the user's buffer with magic values. Check that the values are intact whenever the buffers are freed. This is just to help catch buffer overruns. No overruns have been detected so far with the checks in place.