⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 281001 in webkit


Ignore:
Timestamp:
Aug 12, 2021, 6:13:17 PM (5 years ago)
Author:
ddkilzer@apple.com
Message:

ThreadSanitizer: data race in WebCore::CARingBufferStorageVector::setCurrentFrameBounds() / getCurrentFrameBounds()
<https://webkit.org/b/229014>
<rdar://problem/81817224>

Reviewed by Chris Dumez.

This turned out to be a false-positive since reads and writes
are protected differently, and it's okay if a read returns data
from the ring buffer that is one slot older than the current
write.

Covered by layout tests running with TSan:

fast/mediastream/getUserMedia-webaudio.html
fast/mediastream/mediastreamtrack-audio-clone.html
imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-track-stats.https.html
imported/w3c/web-platform-tests/webrtc/protocol/missing-fields.html
webrtc/audio-peer-connection-g722.html
webrtc/audio-peer-connection-webaudio.html
webrtc/audio-replace-track.html
webrtc/peer-connection-audio-mute.html
webrtc/peer-connection-audio-mute2.html
webrtc/peer-connection-createMediaStreamDestination.html
webrtc/peer-connection-remote-audio-mute.html
webrtc/peer-connection-remote-audio-mute2.html

  • platform/audio/cocoa/CARingBuffer.cpp:

(WebCore::CARingBufferStorageVector::getCurrentFrameBounds):
(WebCore::CARingBufferStorageVector::currentStartFrame const):
(WebCore::CARingBufferStorageVector::currentEndFrame const):

  • Add SUPPRESS_TSAN attribute since reads are protected by std::atomic<int32_t> m_timeBoundsQueuePtr only being incremented after the next m_timeBoundsQueue slot is updated. Writes are potected by Locker locker { m_currentFrameBoundsLock }.
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r280988 r281001  
     12021-08-12  David Kilzer  <ddkilzer@apple.com>
     2
     3        ThreadSanitizer: data race in WebCore::CARingBufferStorageVector::setCurrentFrameBounds() / getCurrentFrameBounds()
     4        <https://webkit.org/b/229014>
     5        <rdar://problem/81817224>
     6
     7        Reviewed by Chris Dumez.
     8
     9        This turned out to be a false-positive since reads and writes
     10        are protected differently, and it's okay if a read returns data
     11        from the ring buffer that is one slot older than the current
     12        write.
     13
     14        Covered by layout tests running with TSan:
     15            fast/mediastream/getUserMedia-webaudio.html
     16            fast/mediastream/mediastreamtrack-audio-clone.html
     17            imported/w3c/web-platform-tests/webrtc/RTCDTMFSender-insertDTMF.https.html
     18            imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html
     19            imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-track-stats.https.html
     20            imported/w3c/web-platform-tests/webrtc/protocol/missing-fields.html
     21            webrtc/audio-peer-connection-g722.html
     22            webrtc/audio-peer-connection-webaudio.html
     23            webrtc/audio-replace-track.html
     24            webrtc/peer-connection-audio-mute.html
     25            webrtc/peer-connection-audio-mute2.html
     26            webrtc/peer-connection-createMediaStreamDestination.html
     27            webrtc/peer-connection-remote-audio-mute.html
     28            webrtc/peer-connection-remote-audio-mute2.html
     29
     30        * platform/audio/cocoa/CARingBuffer.cpp:
     31        (WebCore::CARingBufferStorageVector::getCurrentFrameBounds):
     32        (WebCore::CARingBufferStorageVector::currentStartFrame const):
     33        (WebCore::CARingBufferStorageVector::currentEndFrame const):
     34        - Add SUPPRESS_TSAN attribute since reads are protected by
     35          std::atomic<int32_t> m_timeBoundsQueuePtr only being
     36          incremented after the next m_timeBoundsQueue slot is updated.
     37          Writes are potected by
     38          Locker locker { m_currentFrameBoundsLock }.
     39
    1402021-08-12  Alex Christensen  <achristensen@webkit.org>
    241
  • trunk/Source/WebCore/platform/audio/cocoa/CARingBuffer.cpp

    r278755 r281001  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    326326}
    327327
    328 void CARingBufferStorageVector::getCurrentFrameBounds(uint64_t& startFrame, uint64_t& endFrame)
     328SUPPRESS_TSAN void CARingBufferStorageVector::getCurrentFrameBounds(uint64_t& startFrame, uint64_t& endFrame)
    329329{
    330330    uint32_t curPtr = m_timeBoundsQueuePtr.load();
     
    358358}
    359359
    360 uint64_t CARingBufferStorageVector::currentStartFrame() const
     360SUPPRESS_TSAN uint64_t CARingBufferStorageVector::currentStartFrame() const
    361361{
    362362    uint32_t index = m_timeBoundsQueuePtr.load() & kGeneralRingTimeBoundsQueueMask;
     
    369369}
    370370
    371 uint64_t CARingBufferStorageVector::currentEndFrame() const
     371SUPPRESS_TSAN uint64_t CARingBufferStorageVector::currentEndFrame() const
    372372{
    373373    uint32_t index = m_timeBoundsQueuePtr.load() & kGeneralRingTimeBoundsQueueMask;
Note: See TracChangeset for help on using the changeset viewer.