llvm
0689a9cb - [SYCL][CI][diagnostic] Trace GlobalHandler static-init / adapter ownership

Commit
88 days ago
[SYCL][CI][diagnostic] Trace GlobalHandler static-init / adapter ownership Test which static-init / reset path produces the bad adapter pointer the crash dereferences (intel/llvm#22367). The eager `RTGlobalObjHandler = new GlobalHandler()` (global_handler.cpp:117) is a dynamic initializer whose order vs each test TU's static MockDeviceImageArray (which calls resetGlobalHandler()) is unspecified; resetGlobalHandler() leaks+swaps the instance, and ur::getAdapter<BE>() caches a process-static adapter pointer that is never invalidated across resets. Add an opt-in trace (SYCL_TRACE_ADAPTER_UAF) recording: - GH_CTOR/GH_DTOR per GlobalHandler instance - GH_RESET_OLD/NEW around the resetGlobalHandler swap (now out-of-line) - GH_GET_ADAPTERS p1=owning-instance p2=current RTGlobalObjHandler (mismatch => state split across two handlers) - ADAPTER_CREATED adapter=.. ownerGH=.. ; GETADAPTER_CACHED/RESOLVED adapter=.. curGH=.. (cached pointer surviving a reset => stale adapter) CI runs the full binary (exercises cross-TU reset) then the single crashing test, and uploads the trace. No-op when the env var is unset. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
Parents
Loading