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

sys/net/gnrc_pktbuf_static: add double free detection #20974

Open
wants to merge 2 commits into from

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Nov 11, 2024

Contribution description

The basic idea is: all free data is filled with CANARY bytes, once data is allocated this is overwritten with ~CANARY.
When data is freed we now check if the chunk is only set to CANARY - if this happens, it was already freed.

Testing procedure

Set CONFIG_GNRC_PKTBUF_CHECK_USE_AFTER_FREE to 1.

Issues/PRs references

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Nov 11, 2024
@benpicco benpicco force-pushed the gnrc_pktbuf_static-double-free branch from 9bd4954 to 9c6c2f3 Compare November 11, 2024 13:51
@benpicco benpicco added the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Nov 11, 2024
@benpicco benpicco force-pushed the gnrc_pktbuf_static-double-free branch from 9c6c2f3 to 3d1e6f5 Compare November 11, 2024 14:14
@benpicco benpicco removed the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Nov 11, 2024
@benpicco benpicco force-pushed the gnrc_pktbuf_static-double-free branch from 3d1e6f5 to 982af61 Compare November 11, 2024 14:17
@benpicco benpicco requested a review from maribu November 12, 2024 13:22
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 12, 2024
@riot-ci
Copy link

riot-ci commented Nov 12, 2024

Murdock results

✔️ PASSED

982af61 sys/net/gnrc_pktbuf_static: make hexdump optional

Success Failures Total Runtime
10250 0 10251 18m:04s

Artifacts

@benpicco benpicco added this pull request to the merge queue Nov 14, 2024
@benpicco benpicco added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants