diff --git a/src/profiler/profile-generator.h b/src/profiler/profile-generator.h index 38b3c713de6..8f18209cf08 100644 --- a/src/profiler/profile-generator.h +++ b/src/profiler/profile-generator.h @@ -238,6 +238,15 @@ class CodeEntry { DCHECK(is_ref_counted()); DCHECK_GT(ref_count_, 0UL); ref_count_--; + // POC: race-widening delay only. Does NOT change semantics — the split + // between the fetch_sub above and the load below already exists in the + // original code; this just makes the existing TOCTOU window large enough + // to observe under ASAN. The spin touches only a static atomic so it + // cannot itself fault. + static std::atomic poc_sink{0}; + for (int poc_spin = 0; poc_spin < 100000; poc_spin = poc_spin + 1) { + poc_sink.fetch_add(1, std::memory_order_relaxed); + } return ref_count_; }