Files
hakmem/hakmem.d
Moe Charm (CI) 0546454168 WIP: Add TLS SLL validation and SuperSlab registry fallback
ChatGPT's diagnostic changes to address TLS_SLL_HDR_RESET issue.
Current status: Partial mitigation, but root cause remains.

Changes Applied:
1. SuperSlab Registry Fallback (hakmem_super_registry.h)
   - Added legacy table probe when hash map lookup misses
   - Prevents NULL returns for valid SuperSlabs during initialization
   - Status:  Works but may hide underlying registration issues

2. TLS SLL Push Validation (tls_sll_box.h)
   - Reject push if SuperSlab lookup returns NULL
   - Reject push if class_idx mismatch detected
   - Added [TLS_SLL_PUSH_NO_SS] diagnostic message
   - Status:  Prevents list corruption (defensive)

3. SuperSlab Allocation Class Fix (superslab_allocate.c)
   - Pass actual class_idx to sp_internal_allocate_superslab
   - Prevents dummy class=8 causing OOB access
   - Status:  Root cause fix for allocation path

4. Debug Output Additions
   - First 256 push/pop operations traced
   - First 4 mismatches logged with details
   - SuperSlab registration state logged
   - Status:  Diagnostic tool (not a fix)

5. TLS Hint Box Removed
   - Deleted ss_tls_hint_box.{c,h} (Phase 1 optimization)
   - Simplified to focus on stability first
   - Status:  Can be re-added after root cause fixed

Current Problem (REMAINS UNSOLVED):
- [TLS_SLL_HDR_RESET] still occurs after ~60 seconds of sh8bench
- Pointer is 16 bytes offset from expected (class 1 → class 2 boundary)
- hak_super_lookup returns NULL for that pointer
- Suggests: Use-After-Free, Double-Free, or pointer arithmetic error

Root Cause Analysis:
- Pattern: Pointer offset by +16 (one class 1 stride)
- Timing: Cumulative problem (appears after 60s, not immediately)
- Location: Header corruption detected during TLS SLL pop

Remaining Issues:
⚠️ Registry fallback is defensive (may hide registration bugs)
⚠️ Push validation prevents symptoms but not root cause
⚠️ 16-byte pointer offset source unidentified

Next Steps for Investigation:
1. Full pointer arithmetic audit (Magazine ⇔ TLS SLL paths)
2. Enhanced logging at HDR_RESET point:
   - Expected vs actual pointer value
   - Pointer provenance (where it came from)
   - Allocation trace for that block
3. Verify Headerless flag is OFF throughout build
4. Check for double-offset application in conversions

Technical Assessment:
- 60% root cause fixes (allocation class, validation)
- 40% defensive mitigation (registry fallback, push rejection)

Performance Impact:
- Registry fallback: +10-30 cycles on cold path (negligible)
- Push validation: +5-10 cycles per push (acceptable)
- Overall: < 2% performance impact estimated

Related Issues:
- Phase 1 TLS Hint Box removed temporarily
- Phase 2 Headerless blocked until stability achieved

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 20:42:28 +09:00

218 lines
8.8 KiB
Makefile

hakmem.o: core/hakmem.c core/hakmem.h core/hakmem_build_flags.h \
core/hakmem_config.h core/hakmem_features.h core/hakmem_internal.h \
core/hakmem_sys.h core/hakmem_whale.h core/box/ptr_type_box.h \
core/hakmem_bigcache.h core/hakmem_pool.h \
core/box/hak_lane_classify.inc.h core/hakmem_l25_pool.h \
core/hakmem_policy.h core/hakmem_learner.h core/hakmem_size_hist.h \
core/hakmem_ace.h core/hakmem_site_rules.h core/hakmem_tiny.h \
core/hakmem_trace.h core/hakmem_tiny_mini_mag.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/tiny_remote.h core/hakmem_tiny_superslab_constants.h \
core/tiny_fastcache.h core/hakmem_env_cache.h \
core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
core/tiny_nextptr.h core/tiny_region_id.h core/tiny_box_geometry.h \
core/ptr_track.h core/hakmem_super_registry.h core/box/ss_addr_map_box.h \
core/box/../hakmem_build_flags.h core/tiny_debug_api.h \
core/box/tiny_layout_box.h core/box/../hakmem_tiny_config.h \
core/box/tiny_header_box.h core/box/tiny_layout_box.h \
core/box/../tiny_region_id.h core/hakmem_elo.h core/hakmem_ace_stats.h \
core/hakmem_batch.h core/hakmem_evo.h core/hakmem_debug.h \
core/hakmem_prof.h core/hakmem_syscall.h core/hakmem_ace_controller.h \
core/hakmem_ace_metrics.h core/hakmem_ace_ucb1.h \
core/box/bench_fast_box.h core/ptr_trace.h core/box/hak_kpi_util.inc.h \
core/box/hak_core_init.inc.h core/hakmem_phase7_config.h \
core/box/ss_hot_prewarm_box.h core/box/hak_alloc_api.inc.h \
core/box/../hakmem_tiny.h core/box/../hakmem_pool.h \
core/box/../hakmem_smallmid.h core/box/mid_large_config_box.h \
core/box/../hakmem_config.h core/box/../hakmem_features.h \
core/box/hak_free_api.inc.h core/hakmem_tiny_superslab.h \
core/box/../tiny_free_fast_v2.inc.h core/box/../tiny_region_id.h \
core/box/../hakmem_build_flags.h core/box/../hakmem_tiny_config.h \
core/box/../box/tls_sll_box.h core/box/../box/../hakmem_internal.h \
core/box/../box/../hakmem_tiny_config.h \
core/box/../box/../hakmem_build_flags.h \
core/box/../box/../hakmem_debug_master.h \
core/box/../box/../tiny_remote.h core/box/../box/../tiny_region_id.h \
core/box/../box/../hakmem_tiny_integrity.h \
core/box/../box/../hakmem_tiny.h core/box/../box/../ptr_track.h \
core/box/../box/../tiny_debug_ring.h \
core/box/../box/../superslab/superslab_inline.h \
core/box/../box/tiny_header_box.h core/box/../box/tls_sll_drain_box.h \
core/box/../box/tls_sll_box.h core/box/../box/slab_recycling_box.h \
core/box/../box/../hakmem_tiny_superslab.h \
core/box/../box/../hakmem_shared_pool.h \
core/box/../box/../superslab/superslab_types.h \
core/box/../box/ss_hot_cold_box.h \
core/box/../box/../superslab/superslab_types.h \
core/box/../box/free_local_box.h core/box/../box/ptr_type_box.h \
core/box/../box/free_publish_box.h core/hakmem_tiny.h \
core/tiny_region_id.h core/box/../hakmem_tiny_integrity.h \
core/box/../hakmem_env_cache.h core/box/../superslab/superslab_inline.h \
core/box/../box/ss_slab_meta_box.h \
core/box/../box/slab_freelist_atomic.h core/box/../box/free_remote_box.h \
core/hakmem_tiny_integrity.h core/box/../box/ptr_conversion_box.h \
core/box/../box/tiny_layout_box.h core/box/front_gate_v2.h \
core/box/external_guard_box.h core/box/ss_slab_meta_box.h \
core/box/fg_tiny_gate_box.h core/box/hak_exit_debug.inc.h \
core/box/hak_wrappers.inc.h core/box/front_gate_classifier.h \
core/box/../front/malloc_tiny_fast.h \
core/box/../front/../hakmem_build_flags.h \
core/box/../front/../hakmem_tiny_config.h \
core/box/../front/../superslab/superslab_inline.h \
core/box/../front/../box/ss_slab_meta_box.h \
core/box/../front/tiny_unified_cache.h \
core/box/../front/../box/tiny_front_config_box.h \
core/box/../front/../box/../hakmem_build_flags.h \
core/box/../front/../tiny_region_id.h core/box/../front/../hakmem_tiny.h \
core/box/../front/../box/tiny_front_hot_box.h \
core/box/../front/../box/../hakmem_tiny_config.h \
core/box/../front/../box/../tiny_region_id.h \
core/box/../front/../box/../front/tiny_unified_cache.h \
core/box/../front/../box/tiny_layout_box.h \
core/box/../front/../box/tiny_front_cold_box.h \
core/box/tiny_front_config_box.h core/box/wrapper_env_box.h \
core/box/../hakmem_internal.h core/box/../superslab/superslab_inline.h
core/hakmem.h:
core/hakmem_build_flags.h:
core/hakmem_config.h:
core/hakmem_features.h:
core/hakmem_internal.h:
core/hakmem_sys.h:
core/hakmem_whale.h:
core/box/ptr_type_box.h:
core/hakmem_bigcache.h:
core/hakmem_pool.h:
core/box/hak_lane_classify.inc.h:
core/hakmem_l25_pool.h:
core/hakmem_policy.h:
core/hakmem_learner.h:
core/hakmem_size_hist.h:
core/hakmem_ace.h:
core/hakmem_site_rules.h:
core/hakmem_tiny.h:
core/hakmem_trace.h:
core/hakmem_tiny_mini_mag.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/tiny_remote.h:
core/hakmem_tiny_superslab_constants.h:
core/tiny_fastcache.h:
core/hakmem_env_cache.h:
core/box/tiny_next_ptr_box.h:
core/hakmem_tiny_config.h:
core/tiny_nextptr.h:
core/tiny_region_id.h:
core/tiny_box_geometry.h:
core/ptr_track.h:
core/hakmem_super_registry.h:
core/box/ss_addr_map_box.h:
core/box/../hakmem_build_flags.h:
core/tiny_debug_api.h:
core/box/tiny_layout_box.h:
core/box/../hakmem_tiny_config.h:
core/box/tiny_header_box.h:
core/box/tiny_layout_box.h:
core/box/../tiny_region_id.h:
core/hakmem_elo.h:
core/hakmem_ace_stats.h:
core/hakmem_batch.h:
core/hakmem_evo.h:
core/hakmem_debug.h:
core/hakmem_prof.h:
core/hakmem_syscall.h:
core/hakmem_ace_controller.h:
core/hakmem_ace_metrics.h:
core/hakmem_ace_ucb1.h:
core/box/bench_fast_box.h:
core/ptr_trace.h:
core/box/hak_kpi_util.inc.h:
core/box/hak_core_init.inc.h:
core/hakmem_phase7_config.h:
core/box/ss_hot_prewarm_box.h:
core/box/hak_alloc_api.inc.h:
core/box/../hakmem_tiny.h:
core/box/../hakmem_pool.h:
core/box/../hakmem_smallmid.h:
core/box/mid_large_config_box.h:
core/box/../hakmem_config.h:
core/box/../hakmem_features.h:
core/box/hak_free_api.inc.h:
core/hakmem_tiny_superslab.h:
core/box/../tiny_free_fast_v2.inc.h:
core/box/../tiny_region_id.h:
core/box/../hakmem_build_flags.h:
core/box/../hakmem_tiny_config.h:
core/box/../box/tls_sll_box.h:
core/box/../box/../hakmem_internal.h:
core/box/../box/../hakmem_tiny_config.h:
core/box/../box/../hakmem_build_flags.h:
core/box/../box/../hakmem_debug_master.h:
core/box/../box/../tiny_remote.h:
core/box/../box/../tiny_region_id.h:
core/box/../box/../hakmem_tiny_integrity.h:
core/box/../box/../hakmem_tiny.h:
core/box/../box/../ptr_track.h:
core/box/../box/../tiny_debug_ring.h:
core/box/../box/../superslab/superslab_inline.h:
core/box/../box/tiny_header_box.h:
core/box/../box/tls_sll_drain_box.h:
core/box/../box/tls_sll_box.h:
core/box/../box/slab_recycling_box.h:
core/box/../box/../hakmem_tiny_superslab.h:
core/box/../box/../hakmem_shared_pool.h:
core/box/../box/../superslab/superslab_types.h:
core/box/../box/ss_hot_cold_box.h:
core/box/../box/../superslab/superslab_types.h:
core/box/../box/free_local_box.h:
core/box/../box/ptr_type_box.h:
core/box/../box/free_publish_box.h:
core/hakmem_tiny.h:
core/tiny_region_id.h:
core/box/../hakmem_tiny_integrity.h:
core/box/../hakmem_env_cache.h:
core/box/../superslab/superslab_inline.h:
core/box/../box/ss_slab_meta_box.h:
core/box/../box/slab_freelist_atomic.h:
core/box/../box/free_remote_box.h:
core/hakmem_tiny_integrity.h:
core/box/../box/ptr_conversion_box.h:
core/box/../box/tiny_layout_box.h:
core/box/front_gate_v2.h:
core/box/external_guard_box.h:
core/box/ss_slab_meta_box.h:
core/box/fg_tiny_gate_box.h:
core/box/hak_exit_debug.inc.h:
core/box/hak_wrappers.inc.h:
core/box/front_gate_classifier.h:
core/box/../front/malloc_tiny_fast.h:
core/box/../front/../hakmem_build_flags.h:
core/box/../front/../hakmem_tiny_config.h:
core/box/../front/../superslab/superslab_inline.h:
core/box/../front/../box/ss_slab_meta_box.h:
core/box/../front/tiny_unified_cache.h:
core/box/../front/../box/tiny_front_config_box.h:
core/box/../front/../box/../hakmem_build_flags.h:
core/box/../front/../tiny_region_id.h:
core/box/../front/../hakmem_tiny.h:
core/box/../front/../box/tiny_front_hot_box.h:
core/box/../front/../box/../hakmem_tiny_config.h:
core/box/../front/../box/../tiny_region_id.h:
core/box/../front/../box/../front/tiny_unified_cache.h:
core/box/../front/../box/tiny_layout_box.h:
core/box/../front/../box/tiny_front_cold_box.h:
core/box/tiny_front_config_box.h:
core/box/wrapper_env_box.h:
core/box/../hakmem_internal.h:
core/box/../superslab/superslab_inline.h: