Fix critical type safety bug: enforce hak_base_ptr_t in tiny_alloc_fast_push
Root cause: Functions tiny_alloc_fast_push() and front_gate_push_tls() accepted void* instead of hak_base_ptr_t, allowing implicit conversion of USER pointers to BASE pointers. This caused memory corruption in TLS SLL operations. Changes: - core/tiny_alloc_fast.inc.h:879 - Change parameter type to hak_base_ptr_t - core/tiny_alloc_fast_push.c:17 - Change parameter type to hak_base_ptr_t - core/tiny_free_fast.inc.h:46 - Update extern declaration - core/box/front_gate_box.h:15 - Change parameter type to hak_base_ptr_t - core/box/front_gate_box.c:68 - Change parameter type to hak_base_ptr_t - core/box/tls_sll_box.h - Add misaligned next pointer guard and enhanced logging Result: Zero misaligned next pointer detections in tests. Corruption eliminated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -43,7 +43,7 @@ extern __thread TinyTLSSLL g_tls_sll[TINY_NUM_CLASSES];
|
||||
extern __thread TinyTLSList g_tls_lists[TINY_NUM_CLASSES];
|
||||
|
||||
// Box 5 helper (TLS push)
|
||||
extern void tiny_alloc_fast_push(int class_idx, void* ptr);
|
||||
extern void tiny_alloc_fast_push(int class_idx, hak_base_ptr_t ptr);
|
||||
|
||||
// ========== Ownership Check ==========
|
||||
|
||||
|
||||
Reference in New Issue
Block a user