Fix TLS-SLL splice alignment issue causing SIGSEGV
- core/box/tls_sll_box.h: Normalize splice head, remove heuristics, fix misalignment guard - core/tiny_refill_opt.h: Add LINEAR_LINK debug logging after carve - core/ptr_trace.h: Fix function declaration conflicts for debug builds - core/hakmem.c: Add stdatomic.h include and ptr_trace_dump_now declaration Fixes misaligned memory access in splice_trav that was causing SIGSEGV. TLS-SLL GUARD identified: base=0x7244b7e10009 (should be 0x7244b7e10401) Preserves existing ptr=0xa0 guard for small pointer free detection. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@ -230,6 +230,17 @@ static inline uint32_t trc_linear_carve(uint8_t* base, size_t bs,
|
||||
cursor = next;
|
||||
}
|
||||
void* tail = (void*)cursor;
|
||||
// Debug: validate first link
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
if (batch >= 2) {
|
||||
void* first_next = *(void**)((uint8_t*)head + next_offset);
|
||||
fprintf(stderr, "[LINEAR_LINK] cls=%d head=%p off=%zu next=%p tail=%p\n",
|
||||
class_idx, head, (size_t)next_offset, first_next, tail);
|
||||
} else {
|
||||
fprintf(stderr, "[LINEAR_LINK] cls=%d head=%p off=%zu next=%p tail=%p\n",
|
||||
class_idx, head, (size_t)next_offset, (void*)0, tail);
|
||||
}
|
||||
#endif
|
||||
// FIX: Update both carved (monotonic) and used (active count)
|
||||
meta->carved += batch;
|
||||
meta->used += batch;
|
||||
|
||||
Reference in New Issue
Block a user