Phase 6-2.4: Fix SuperSlab free SEGV: remove guess loop and add memory readability check; add registry atomic consistency (base as _Atomic uintptr_t with acq/rel); add debug toggles (SUPER_REG_DEBUG/REQTRACE); update CURRENT_TASK with results and next steps; capture suite results.
This commit is contained in:
@ -2,6 +2,23 @@
|
||||
#ifndef HAK_CORE_INIT_INC_H
|
||||
#define HAK_CORE_INIT_INC_H
|
||||
|
||||
#include <signal.h>
|
||||
#ifdef __GLIBC__
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
// Debug-only SIGSEGV handler (gated by HAKMEM_DEBUG_SEGV)
|
||||
static void hakmem_sigsegv_handler(int sig) {
|
||||
#ifdef __GLIBC__
|
||||
void* bt[64]; int n = backtrace(bt, 64);
|
||||
fprintf(stderr, "\n[HAKMEM][SIGSEGV] dumping backtrace (%d frames)\n", n);
|
||||
backtrace_symbols_fd(bt, n, fileno(stderr));
|
||||
#else
|
||||
(void)sig;
|
||||
fprintf(stderr, "\n[HAKMEM][SIGSEGV] (execinfo unavailable)\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hak_init_impl(void);
|
||||
static pthread_once_t g_init_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
@ -17,6 +34,17 @@ static void hak_init_impl(void) {
|
||||
// dlsym() initializes function pointers to real libc (bypasses LD_PRELOAD)
|
||||
hkm_syscall_init();
|
||||
|
||||
// Optional: one-shot SIGSEGV backtrace for early crash diagnosis
|
||||
do {
|
||||
const char* dbg = getenv("HAKMEM_DEBUG_SEGV");
|
||||
if (dbg && atoi(dbg) != 0) {
|
||||
struct sigaction sa; memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_flags = SA_RESETHAND;
|
||||
sa.sa_handler = hakmem_sigsegv_handler;
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
// NEW Phase 6.11.1: Initialize debug timing
|
||||
hkm_timing_init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user