Debug patches: C7 logging, Front Gate detection, TLS-SLL fixes
- Add C7 first alloc/free logging for path verification - Add Front Gate libc bypass detection with counter - Fix TLS-SLL splice alignment issues causing SIGSEGV - Add ptr_trace dump capabilities for debugging - Include LINEAR_LINK debug logging after carve - Preserve ptr=0xa0 guard for small pointer detection Debug improvements help isolate memory corruption issues in Tiny allocator. Front Gate detection helps identify libc bypass patterns. TLS-SLL fixes resolve misaligned memory access causing crashes. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@ -18,6 +18,25 @@
|
||||
static inline void* superslab_alloc_from_slab(SuperSlab* ss, int slab_idx) {
|
||||
TinySlabMeta* meta = &ss->slabs[slab_idx];
|
||||
|
||||
// Phase 1 (Small): For hottest tiny classes (C0–C3), prefer strict bump-only
|
||||
// when there is no pending remote and the freelist is empty. This avoids
|
||||
// pointer-chasing and header writes entirely on the common path.
|
||||
do {
|
||||
if (__builtin_expect(ss->size_class <= 3, 1)) {
|
||||
// Skip if remote queue has pending nodes
|
||||
if (atomic_load_explicit(&ss->remote_heads[slab_idx], memory_order_acquire) != 0)
|
||||
break;
|
||||
if (meta->freelist == NULL && meta->used < meta->capacity) {
|
||||
size_t unit_sz = tiny_stride_for_class(ss->size_class);
|
||||
uint8_t* base = tiny_slab_base_for_geometry(ss, slab_idx);
|
||||
void* block = tiny_block_at_index(base, meta->used, unit_sz);
|
||||
meta->used++;
|
||||
ss_active_inc(ss);
|
||||
HAK_RET_ALLOC(ss->size_class, block);
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
|
||||
// Ensure remote queue is drained before handing blocks back to TLS (UNLIKELY in 1T)
|
||||
if (__builtin_expect(atomic_load_explicit(&ss->remote_heads[slab_idx], memory_order_acquire) != 0, 0)) {
|
||||
uint32_t self_tid = tiny_self_u32();
|
||||
|
||||
Reference in New Issue
Block a user