Skip to content

Conversation

@hanno-becker
Copy link
Contributor

@hanno-becker hanno-becker commented Dec 21, 2025

Implements allocation failure testing by using a custom allocator that
can fail at specific points.

The test also checks that freeing happens in reverse order to
allocation, allowing simple bump allocator implementations.

@hanno-becker hanno-becker requested a review from a team as a code owner December 21, 2025 19:54
@hanno-becker hanno-becker force-pushed the alloc_test branch 14 times, most recently from f08f166 to 5b8519f Compare December 22, 2025 16:31
@hanno-becker hanno-becker force-pushed the alloc_test branch 7 times, most recently from fc2ddb2 to 8e132e0 Compare December 25, 2025 04:38
Copy link
Contributor

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

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

Thanks @hanno-becker. Could you reduce the diff to mlkem-native to make maintenance easier down the line.

Copy link
Contributor

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

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

Thanks @hanno-becker for also adding it to the CI. One more nit, then this is good to merge.

Tests that the toplevel API correctly handles allocation failures by:
- Returning MLD_ERR_OUT_OF_MEMORY on allocation failure
- Cleaning up all allocated memory (no leaks)
- Freeing in LIFO order (enabling bump allocator use)

Uses custom bump allocator with LIFO tracking to systematically inject
failures at each allocation point and verify error handling.

Signed-off-by: Hanno Becker <[email protected]>
Copy link
Contributor

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

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

Thanks @hanno-becker!

@mkannwischer mkannwischer merged commit 34281c3 into main Dec 28, 2025
328 checks passed
@mkannwischer mkannwischer deleted the alloc_test branch December 28, 2025 13:36
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.

3 participants