Title: [259717] trunk/Source/WebKit
Revision
259717
Author
[email protected]
Date
2020-04-08 08:37:53 -0700 (Wed, 08 Apr 2020)

Log Message

Regression(r259610) [RBSTarget targetWithPid:] may throw a 'must specify a valid pid' exception
https://bugs.webkit.org/show_bug.cgi?id=210159

Reviewed by Alex Christensen.

[RBSTarget targetWithPid:] may throw a 'must specify a valid pid' exception since r259610. There
are apparently cases where the PID we are passing the ProcessAssertion is 0 (likely process crash
on startup). BKSAssertion used to deal with this silently but RBSAssertion actually throws an
exception in this case. To maintain the old behavior, we should do an explicit check to make sure
the PID is valid before passing it to RunningBoard.

* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::ProcessAssertion):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (259716 => 259717)


--- trunk/Source/WebKit/ChangeLog	2020-04-08 15:03:09 UTC (rev 259716)
+++ trunk/Source/WebKit/ChangeLog	2020-04-08 15:37:53 UTC (rev 259717)
@@ -1,3 +1,19 @@
+2020-04-08  Chris Dumez  <[email protected]>
+
+        Regression(r259610) [RBSTarget targetWithPid:] may throw a 'must specify a valid pid' exception
+        https://bugs.webkit.org/show_bug.cgi?id=210159
+
+        Reviewed by Alex Christensen.
+
+        [RBSTarget targetWithPid:] may throw a 'must specify a valid pid' exception since r259610. There
+        are apparently cases where the PID we are passing the ProcessAssertion is 0 (likely process crash
+        on startup). BKSAssertion used to deal with this silently but RBSAssertion actually throws an
+        exception in this case. To maintain the old behavior, we should do an explicit check to make sure
+        the PID is valid before passing it to RunningBoard.
+
+        * UIProcess/ios/ProcessAssertionIOS.mm:
+        (WebKit::ProcessAssertion::ProcessAssertion):
+
 2020-04-08  Claudio Saavedra  <[email protected]>
 
         [GTK] Drop usage of deprecated GdkDeviceManager

Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (259716 => 259717)


--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm	2020-04-08 15:03:09 UTC (rev 259716)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm	2020-04-08 15:37:53 UTC (rev 259717)
@@ -359,6 +359,11 @@
     NSString *nsReason = [NSString stringWithCString:reason.characters() encoding:NSASCIIStringEncoding];
     NSString *runningBoardAssertionName = runningBoardNameForAssertionType(assertionType);
     if (runningBoardAssertionName) {
+        if (!pid) {
+            RELEASE_LOG_ERROR(ProcessSuspension, "%p - ProcessAssertion: Failed to acquire RBS %{public}@ assertion '%{public}s' for process because PID is invalid", this, runningBoardAssertionName, reason.characters());
+            return;
+        }
+
         RBSTarget *target = [RBSTarget targetWithPid:pid];
         RBSDomainAttribute *domainAttribute = [RBSDomainAttribute attributeWithDomain:@"com.apple.webkit" name:runningBoardAssertionName];
         m_rbsAssertion = adoptNS([[RBSAssertion alloc] initWithExplanation:nsReason target:target attributes:@[domainAttribute]]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to