llvm
0a0ba8eb - [SYCL][CI][diagnostic] Trace adapter identity at ~Managed release

Commit
85 days ago
[SYCL][CI][diagnostic] Trace adapter identity at ~Managed release The cdb/in-process crash stack confirmed the UAF is ~Managed<ur_program> (adapter_impl.hpp:283) calling through an adapter whose func-ptr table is null. To determine whether that adapter pointer is a still-live adapter (so the table was never populated / something reset it) or a stale/freed object, add an opt-in trace (SYCL_TRACE_ADAPTER_UAF): - adapter_impl ctor/dtor register/unregister `this` in a process-global live set. - ~Managed, before releasing, emits MANAGED_RELEASE with the adapter pointer and whether it is in the live set. Only if live (safe to deref) does it also report adapterReleased and the first func-ptr word -- it never dereferences a pointer that is not currently a live adapter. This distinguishes the two hypotheses: LIVE=0 STALE_OR_FREED => use-after-free / two-adapter lifetime bug; LIVE=1 with a null firstFuncPtr => a live but unpopulated/reset adapter. Teardown-safe OS-append sink, leaked mutex/set so they outlive late ~Managed. No-op when the env var is unset. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
Parents
Loading