Conversation
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/tlsf.c">
<violation number="1" location="src/tlsf.c:564">
P2: ASan coverage gap: the left-trim free block in `block_ltrim_free` is never poisoned. After `block_split` poisons only the right portion (`rest`), the left portion (`block`) is inserted into the free list with its payload fully unpoisoned. Stale accesses to that region won't be detected by ASan.
Add `block_poison_free(block)` after `block_insert(t, block)` in `block_ltrim_free`, matching the pattern used in `arena_grow`, `arena_append_pool`, and `tlsf_free`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Teach AddressSanitizer about TLSF's internal pool layout so it can detect use-after-free and buffer overflow within custom memory pools. Free block payloads are poisoned (excluding embedded TLSF metadata: free-list pointers and next block's prev pointer), and unpoisoned on allocation, realloc expansion, and pool growth/append. A separate compile-time option (-DTLSF_ENABLE_POISON) fills payloads with 0xAA on alloc and 0xFF on free, catching stale-pointer bugs on bare-metal targets where sanitizers are unavailable. Extend CI matrix with ASan+UBSan builds for gcc and clang on both x86-64 and ARM64, plus a combined ASan+POISON configuration.
WCET Results (x86-64) |
WCET Results (arm64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Teach AddressSanitizer about TLSF's internal pool layout so it can detect use-after-free and buffer overflow within custom memory pools. Free block payloads are poisoned (excluding embedded TLSF metadata: free-list pointers and next block's prev pointer), and unpoisoned on allocation, realloc expansion, and pool growth/append.
A separate compile-time option (-DTLSF_ENABLE_POISON) fills payloads with 0xAA on alloc and 0xFF on free, catching stale-pointer bugs on bare-metal targets where sanitizers are unavailable.
Extend CI matrix with ASan+UBSan builds for gcc and clang on both x86-64 and ARM64, plus a combined ASan+POISON configuration.
Summary by cubic
Integrates ASan shadow poisoning into TLSF to catch use-after-free and overflows, plus an optional fill-pattern mode for bare‑metal. CI adds ASan+UBSan on x86‑64 (gcc/clang) and ARM64 (gcc), and an ASan+POISON job on x86‑64 (clang).
New Features
Migration
Written for commit d2ee54b. Summary will update on new commits.