Skip to content

test: add coverage for untested allocator behavior - #370

Open
jvoisin wants to merge 1 commit into
GrapheneOS:mainfrom
jvoisin:coverage
Open

test: add coverage for untested allocator behavior#370
jvoisin wants to merge 1 commit into
GrapheneOS:mainfrom
jvoisin:coverage

Conversation

@jvoisin

@jvoisin jvoisin commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Add small self-contained test cases and wire them into the Makefile and test_smc.py harness:

  • invalid_free_aligned_sized_small: free_aligned_sized() with a non-power-of-two alignment, covering the "invalid sized deallocation alignment (small)" fatal path.
  • invalid_malloc_object_size_small_canary: malloc_object_size() queried at an offset past the usable region, covering the "invalid malloc_object_size (canary)" fatal path.
  • pvalloc: regression test for pvalloc(0) returning a valid allocation.
  • reallocarray_overflow: reallocarray() returns NULL/ENOMEM on overflow.
  • posix_memalign_einval: posix_memalign() returns EINVAL for an invalid alignment and leaves the output pointer untouched.
  • aligned_alloc_einval: aligned_alloc() returns NULL/EINVAL for a non-power-of-two alignment.

Add small self-contained test cases and wire them into the Makefile and
test_smc.py harness:

- invalid_free_aligned_sized_small: free_aligned_sized() with a
  non-power-of-two alignment, covering the "invalid sized deallocation
  alignment (small)" fatal path.
- invalid_malloc_object_size_small_canary: malloc_object_size() queried
  at an offset past the usable region, covering the
  "invalid malloc_object_size (canary)" fatal path.
- pvalloc: regression test for pvalloc(0) returning a valid allocation.
- reallocarray_overflow: reallocarray() returns NULL/ENOMEM on overflow.
- posix_memalign_einval: posix_memalign() returns EINVAL for an invalid
  alignment and leaves the output pointer untouched.
- aligned_alloc_einval: aligned_alloc() returns NULL/EINVAL for a
  non-power-of-two alignment.
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