Title: [284373] trunk/Source
Revision
284373
Author
[email protected]
Date
2021-10-18 08:30:23 -0700 (Mon, 18 Oct 2021)

Log Message

Bug 231882: WebKit::GPUConnectionToWebProcess::setTCCIdentity() leaks a tcc_identity_t
<https://webkit.org/b/231882>
<rdar://problem/84350854>

Reviewed by Chris Dumez.

Source/WebCore/PAL:

* pal/spi/cocoa/TCCSPI.h:
- Properly declare tcc_identity_t as an OSObject.

Source/WebKit:

* GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
(WebKit::GPUConnectionToWebProcess::setTCCIdentity):
- Use WTF::adoptOSObject() to fix the leak.
- Expand the scope of !PLATFORM(MACCATALYST) since none of this
  code needs to run on the MacCatalyst platform.

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (284372 => 284373)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-10-18 14:57:56 UTC (rev 284372)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-10-18 15:30:23 UTC (rev 284373)
@@ -1,3 +1,14 @@
+2021-10-18  David Kilzer  <[email protected]>
+
+        Bug 231882: WebKit::GPUConnectionToWebProcess::setTCCIdentity() leaks a tcc_identity_t
+        <https://webkit.org/b/231882>
+        <rdar://problem/84350854>
+
+        Reviewed by Chris Dumez.
+
+        * pal/spi/cocoa/TCCSPI.h:
+        - Properly declare tcc_identity_t as an OSObject.
+
 2021-10-18  Carlos Garcia Campos  <[email protected]>
 
         [GLIB] Simplify SleepDisabler by checking if we are under sandbox

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/TCCSPI.h (284372 => 284373)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/TCCSPI.h	2021-10-18 14:57:56 UTC (rev 284372)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/TCCSPI.h	2021-10-18 15:30:23 UTC (rev 284373)
@@ -31,6 +31,8 @@
 
 #else
 
+#include <os/object.h>
+
 typedef enum {
     kTCCAccessPreflightGranted,
     kTCCAccessPreflightDenied,
@@ -39,7 +41,7 @@
 #if HAVE(TCC_IOS_14_BIG_SUR_SPI)
 typedef uint64_t tcc_identity_type_t;
 constexpr tcc_identity_type_t TCC_IDENTITY_CODE_BUNDLE_ID = 0;
-typedef void* tcc_identity_t;
+OS_OBJECT_DECL_CLASS(tcc_identity);
 #endif // HAVE(TCC_IOS_14_BIG_SUR_SPI)
 
 #endif

Modified: trunk/Source/WebKit/ChangeLog (284372 => 284373)


--- trunk/Source/WebKit/ChangeLog	2021-10-18 14:57:56 UTC (rev 284372)
+++ trunk/Source/WebKit/ChangeLog	2021-10-18 15:30:23 UTC (rev 284373)
@@ -1,3 +1,17 @@
+2021-10-18  David Kilzer  <[email protected]>
+
+        Bug 231882: WebKit::GPUConnectionToWebProcess::setTCCIdentity() leaks a tcc_identity_t
+        <https://webkit.org/b/231882>
+        <rdar://problem/84350854>
+
+        Reviewed by Chris Dumez.
+
+        * GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
+        (WebKit::GPUConnectionToWebProcess::setTCCIdentity):
+        - Use WTF::adoptOSObject() to fix the leak.
+        - Expand the scope of !PLATFORM(MACCATALYST) since none of this
+          code needs to run on the MacCatalyst platform.
+
 2021-10-18  Kimmo Kinnunen  <[email protected]>
 
         Cocoa GraphicsContextGLOpenGL should not use WebGLLayer

Modified: trunk/Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm (284372 => 284373)


--- trunk/Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm	2021-10-18 14:57:56 UTC (rev 284372)
+++ trunk/Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm	2021-10-18 15:30:23 UTC (rev 284373)
@@ -35,6 +35,7 @@
 #import <WebCore/RegistrableDomain.h>
 #import <WebCore/SecurityOrigin.h>
 #import <pal/spi/cocoa/LaunchServicesSPI.h>
+#import <wtf/OSObjectPtr.h>
 
 #import "TCCSoftLink.h"
 #import <pal/ios/SystemStatusSoftLink.h>
@@ -68,6 +69,7 @@
 #if ENABLE(APP_PRIVACY_REPORT)
 void GPUConnectionToWebProcess::setTCCIdentity()
 {
+#if !PLATFORM(MACCATALYST)
     auto auditToken = gpuProcess().parentProcessConnection()->getAuditToken();
     if (!auditToken)
         return;
@@ -77,16 +79,14 @@
     if (error)
         return;
 
-    tcc_identity_t identity = nil;
-    identity = tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, [bundleProxy.bundleIdentifier UTF8String]);
+    auto identity = adoptOSObject(tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, [bundleProxy.bundleIdentifier UTF8String]));
     if (!identity)
         return;
 
-#if !PLATFORM(MACCATALYST)
-    WebCore::RealtimeMediaSourceCenter::singleton().setIdentity(identity);
-#endif
+    WebCore::RealtimeMediaSourceCenter::singleton().setIdentity(identity.get());
+#endif // !PLATFORM(MACCATALYST)
 }
-#endif
+#endif // ENABLE(APP_PRIVACY_REPORT)
 } // namespace WebKit
 
 #endif // ENABLE(GPU_PROCESS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to