Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Issue 1588563004: tracing: Fix AddMetadataEvent race in presence of Convertable arguments (Closed)

Created:
4 years, 11 months ago by Primiano Tucci (use gerrit)
Modified:
4 years, 11 months ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org, vmpstr+watch_chromium.org, Alexander Potapenko
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

tracing: Fix AddMetadataEvent race in presence of Convertable arguments crrev.com/1421053002 introduced a TraceLog::AddMetadataEvent method. This method has a little race, unveiled by crbug.com/559117. The race happens only when a ConvertableToTraceFormat is passed to AddMetadataEvent. Explanation of the race: - AddMetadataEvent takes optional ConvertableToTraceFormat args. - ConvertableToTraceFormat is RefCounted but not RCThreadSafe. - AddMetadataEvent acquires the global TraceLog lock_ (which is good) but does that only after having initialized the trace_event. - CTTF args are copied into the TraceEvent outside of the TraceLog lock. The underlying CTTF AddRef/Deref happen outside the lock. - Later, when we get to AddMetadataEventsWhileLocked we try to re-AddRef the CTTF args. At this point TSAN barks because the CTTF refcount is written both ouside and inside the lock. The fix is trivial, just anticipate the lock of AddMetadataEvent by one statement. BUG=559117 TBR=oysteine@chromium.org Committed: https://crrev.com/5c0f93b3235b44f0c69b23063fa10e49da067666 Cr-Commit-Position: refs/heads/master@{#369401}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M base/trace_event/trace_log.cc View 2 chunks +1 line, -1 line 0 comments Download

Messages

Total messages: 13 (7 generated)
Primiano Tucci (use gerrit)
1 liner
4 years, 11 months ago (2016-01-14 11:19:37 UTC) #2
Ruud van Asseldonk
On 2016/01/14 11:19:37, Primiano Tucci wrote: > 1 liner LGTM with nit: > The fix ...
4 years, 11 months ago (2016-01-14 11:27:31 UTC) #3
petrcermak
LGTM with zero comments. Thanks, Petr
4 years, 11 months ago (2016-01-14 11:58:18 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1588563004/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1588563004/1
4 years, 11 months ago (2016-01-14 11:58:57 UTC) #9
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 11 months ago (2016-01-14 12:33:55 UTC) #11
commit-bot: I haz the power
4 years, 11 months ago (2016-01-14 12:35:54 UTC) #13
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/5c0f93b3235b44f0c69b23063fa10e49da067666
Cr-Commit-Position: refs/heads/master@{#369401}

Powered by Google App Engine
This is Rietveld 408576698