Root cause identified by Task agent investigation: - superslab_allocate() called without declaration in 2 files - Compiler assumes implicit int return type (C99 standard) - Actual signature returns SuperSlab* (64-bit pointer) - Pointer truncated to 32-bit int, then sign-extended to 64-bit - Results in corrupted pointer and segmentation fault Mechanism of corruption: 1. superslab_allocate() returns 0x00005555eba00000 2. Compiler expects int, reads only %eax: 0xeba00000 3. movslq %eax,%rbp sign-extends with bit 31 set 4. Result: 0xffffffffeba00000 (invalid pointer) 5. Dereferencing causes SEGFAULT Files fixed: 1. hakmem_tiny_superslab_internal.h - Added box/ss_allocation_box.h (fixes superslab_head.c via transitive include) 2. hakmem_super_registry.c - Added box/ss_allocation_box.h Warnings eliminated: - "implicit declaration of function 'superslab_allocate'" - "type of 'superslab_allocate' does not match original declaration" - "code may be misoptimized unless '-fno-strict-aliasing' is used" Test results: - larson_hakmem now runs without segfault ✓ - Multiple test runs confirmed stable ✓ - 2 threads, 4 threads: All passing ✓ Impact: - CRITICAL severity bug (affects all SuperSlab expansion) - Intermittent (depends on memory layout ~50% probability) - Now FIXED completely 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
26 lines
1.1 KiB
Makefile
26 lines
1.1 KiB
Makefile
hakmem_super_registry.o: core/hakmem_super_registry.c \
|
|
core/hakmem_super_registry.h core/hakmem_tiny_superslab.h \
|
|
core/superslab/superslab_types.h core/hakmem_tiny_superslab_constants.h \
|
|
core/superslab/superslab_inline.h core/superslab/superslab_types.h \
|
|
core/superslab/../tiny_box_geometry.h \
|
|
core/superslab/../hakmem_tiny_superslab_constants.h \
|
|
core/superslab/../hakmem_tiny_config.h core/tiny_debug_ring.h \
|
|
core/hakmem_build_flags.h core/tiny_remote.h \
|
|
core/hakmem_tiny_superslab_constants.h core/box/ss_allocation_box.h \
|
|
core/hakmem_tiny_superslab.h
|
|
core/hakmem_super_registry.h:
|
|
core/hakmem_tiny_superslab.h:
|
|
core/superslab/superslab_types.h:
|
|
core/hakmem_tiny_superslab_constants.h:
|
|
core/superslab/superslab_inline.h:
|
|
core/superslab/superslab_types.h:
|
|
core/superslab/../tiny_box_geometry.h:
|
|
core/superslab/../hakmem_tiny_superslab_constants.h:
|
|
core/superslab/../hakmem_tiny_config.h:
|
|
core/tiny_debug_ring.h:
|
|
core/hakmem_build_flags.h:
|
|
core/tiny_remote.h:
|
|
core/hakmem_tiny_superslab_constants.h:
|
|
core/box/ss_allocation_box.h:
|
|
core/hakmem_tiny_superslab.h:
|