Skip to content

bufpool: check for buffer overruns, idm: add callback to handle cleanup#6577

Merged
shefty merged 3 commits intoofiwg:masterfrom
shefty:master
Feb 19, 2021
Merged

bufpool: check for buffer overruns, idm: add callback to handle cleanup#6577
shefty merged 3 commits intoofiwg:masterfrom
shefty:master

Conversation

@shefty
Copy link
Copy Markdown
Member

@shefty shefty commented Feb 19, 2021

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.

Sean Hefty 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>
@shefty
Copy link
Copy Markdown
Member Author

shefty commented Feb 19, 2021

Hmm... the changes break all windows release builds. The macros must not work there. Investigating.

@shefty
Copy link
Copy Markdown
Member Author

shefty commented Feb 19, 2021

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>
@shefty
Copy link
Copy Markdown
Member Author

shefty commented Feb 19, 2021

bot:aws:retest

@shefty shefty merged commit a491e7c into ofiwg:master Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant