Major Features: - Debug counter infrastructure for Refill Stage tracking - Free Pipeline counters (ss_local, ss_remote, tls_sll) - Diagnostic counters for early return analysis - Unified larson.sh benchmark runner with profiles - Phase 6-3 regression analysis documentation Bug Fixes: - Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB) - Fix profile variable naming consistency - Add .gitignore patterns for large files Performance: - Phase 6-3: 4.79 M ops/s (has OOM risk) - With SuperSlab: 3.13 M ops/s (+19% improvement) This is a clean repository without large log files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1.5 KiB
1.5 KiB
Free Safety (Debug Guards)
Goal
- Detect invalid/double free and class mismatches early, with minimal intrusion on hot paths (debug‑only).
Envs
HAKMEM_SAFE_FREE=1- Enable free‑time validations (SS range, block alignment/size/capacity, light freelist scan for duplicates).
HAKMEM_SAFE_FREE_STRICT=1- Fail‑Fast (emit Tiny Ring + raise SIGUSR2) when invalid free is detected.
Checks (SuperSlab path)
- Pointer must map to a registered
SuperSlab(registry lookup +magiccheck). - Block alignment:
(ptr - slab_base) % block_size == 0and< block_size * capacity. - Optional duplicate scan: traverse up to 64 nodes of
meta->freelistto see ifptris already present. - Cross lookup note: the same virtual base may be reused by a different class after SS free/cache reuse.
- Two consecutive
free_enterwith different classes on the same pointer likely means double free, not freelist corruption.
- Two consecutive
Checks (TinySlab path)
- Registry lookup + membership (ptr in
[base, base+64KB)). - Optional duplicate scan (same as above; beware of cost).
Ring Guidance
- Record
free_enterbefore validation. - On invalid free: record ring with pointer/class and boundary that failed; if STRICT then raise SIGUSR2.
Limitations
- No per‑block headers: we avoid storing tags in user memory; detection focuses on boundary and freelist duplication checks.
- Reallocate‑then‑free(UAF) after the pointer is reused may evade duplicate scan; STRICT mode is recommended when chasing crashes.