Changeset 249712 in webkit


Ignore:
Timestamp:
Sep 10, 2019 6:52:37 AM (5 years ago)
Author:
youenn@apple.com
Message:

UserMediaProcessManager is revoking sandbox extensions too aggressively
https://bugs.webkit.org/show_bug.cgi?id=201638

Reviewed by Eric Carlson.

Sandbox revocation was sometimes happening when a page is being closed while another page from the same process is starting capture.
In that case, revocation might happen while it should not.
To prevent this, we do not revoke sandbox extensions if there are pending captures for a page of the process.
Whenever a page does not have any pending capture, sandbox extensions may be revoked.

Covered by OnDeviceChangeCrash API test in debug mode.

  • UIProcess/UserMediaPermissionRequestManagerProxy.cpp:

(WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):

  • UIProcess/UserMediaPermissionRequestManagerProxy.h:

(WebKit::UserMediaPermissionRequestManagerProxy::hasPendingCapture const):

  • UIProcess/UserMediaProcessManager.cpp:

(WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r249703 r249712  
     12019-09-10  Youenn Fablet  <youenn@apple.com>
     2
     3        UserMediaProcessManager is revoking sandbox extensions too aggressively
     4        https://bugs.webkit.org/show_bug.cgi?id=201638
     5
     6        Reviewed by Eric Carlson.
     7
     8        Sandbox revocation was sometimes happening when a page is being closed while another page from the same process is starting capture.
     9        In that case, revocation might happen while it should not.
     10        To prevent this, we do not revoke sandbox extensions if there are pending captures for a page of the process.
     11        Whenever a page does not have any pending capture, sandbox extensions may be revoked.
     12
     13        Covered by OnDeviceChangeCrash API test in debug mode.
     14
     15        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
     16        (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
     17        * UIProcess/UserMediaPermissionRequestManagerProxy.h:
     18        (WebKit::UserMediaPermissionRequestManagerProxy::hasPendingCapture const):
     19        * UIProcess/UserMediaProcessManager.cpp:
     20        (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded):
     21
    1222019-09-09  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp

    r249275 r249712  
    242242        if (!weakThis)
    243243            return;
    244         --m_hasPendingCapture;
     244        if (!--m_hasPendingCapture)
     245            UserMediaProcessManager::singleton().revokeSandboxExtensionsIfNeeded(page().process());
    245246    }, m_page.webPageID());
    246247
  • trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h

    r248847 r249712  
    8888
    8989    void setMockCaptureDevicesEnabledOverride(Optional<bool> enabled) { m_mockDevicesEnabledOverride = enabled; }
     90    bool hasPendingCapture() const { return m_hasPendingCapture; }
    9091
    9192private:
  • trunk/Source/WebKit/UIProcess/UserMediaProcessManager.cpp

    r245335 r249712  
    131131    bool hasAudioCapture = false;
    132132    bool hasVideoCapture = false;
    133 
    134     UserMediaPermissionRequestManagerProxy::forEach([&hasAudioCapture, &hasVideoCapture, &process](auto& managerProxy) {
     133    bool hasPendingCapture = false;
     134
     135    UserMediaPermissionRequestManagerProxy::forEach([&hasAudioCapture, &hasVideoCapture, &hasPendingCapture, &process](auto& managerProxy) {
    135136        if (&process != &managerProxy.page().process())
    136137            return;
    137138        hasAudioCapture |= managerProxy.page().isCapturingAudio();
    138139        hasVideoCapture |= managerProxy.page().isCapturingVideo();
    139     });
     140        hasPendingCapture |= managerProxy.hasPendingCapture();
     141    });
     142
     143    if (hasPendingCapture)
     144        return;
    140145
    141146    if (hasAudioCapture && hasVideoCapture)
Note: See TracChangeset for help on using the changeset viewer.