Skip to content
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

slabinfo: detect circular freelists #110

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

brenns10
Copy link
Member

@brenns10 brenns10 commented Oct 1, 2024

We use a set to track the freelist, but we don't actually use it to check whether we've seen the object in the freelist. If an object gets double freed, we'll enter into an infinite loop.

Check this and raise an error. Since we're already detecting invalid freelist pointers as one kind of error, let's add an exception class hierarchy to represent freelist errors, and then we can put this into the slabinfo directly. Then, we can format the information in a table at the end of the slabinfo.

We use a set to track the freelist, but we don't actually use it to
check whether we've seen the object in the freelist. If an object gets
double freed, we'll enter into an infinite loop.

Check this and raise an error. Since we're already detecting invalid
freelist pointers as one kind of error, let's add an exception class
hierarchy to represent freelist errors, and then we can put this into
the slabinfo directly. Then, we can format the information in a table at
the end of the slabinfo.

Signed-off-by: Stephen Brennan <[email protected]>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 1, 2024
@brenns10
Copy link
Member Author

brenns10 commented Oct 1, 2024

Example output:

...
ffff99f1d69a9880        232      100133*      304       19       4k  skbuff_head_cache
...
WARNING: freelist corruption was detected. It is likely that a use-after-free or double-free bug occurred.
CACHE                     CPU  ERROR
skbuff_head_cache         0    duplicate freelist entry on cpu 0: ffff99f44bf6c800
skbuff_head_cache         1    duplicate freelist entry on cpu 1: ffff99f22e558c00

Copy link
Contributor

@imran-kn imran-kn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it :)

@brenns10 brenns10 merged commit b109c68 into oracle-samples:main Oct 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants