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:
Moe Charm (CI)
2025-12-04 04:58:22 +09:00
parent f9460752ea
commit abb7512f1e
6 changed files with 42 additions and 6 deletions

View File

@ -14,7 +14,7 @@
#include "box/tls_sll_box.h"
#include "box/front_gate_box.h"
void tiny_alloc_fast_push(int class_idx, void* ptr) {
void tiny_alloc_fast_push(int class_idx, hak_base_ptr_t ptr) {
#ifdef HAKMEM_TINY_FRONT_GATE_BOX
// When FrontGate Box is enabled, delegate to its TLS push helper.
front_gate_push_tls(class_idx, ptr);