Title: [253353] trunk/Source/WebCore
- Revision
- 253353
- Author
- [email protected]
- Date
- 2019-12-10 15:39:13 -0800 (Tue, 10 Dec 2019)
Log Message
Make it possible to add regression tests for blocked XPC services
https://bugs.webkit.org/show_bug.cgi?id=204967
Reviewed by Brent Fulgham.
On macOS and iOS, it should be possible to add regression tests for blocked mach services. Add a method
to Internals, which checks whether a given process has access to mach lookup for a given global service
name. Currently, the only supported process is the WebContent process since the PIDs of other processes
are not readily available in Internals, but support for other processes will be added when needed.
No new tests, since this patch is in preparation for adding regression tests for sandbox changes.
* testing/Internals.cpp:
(WebCore::Internals::hasSandboxMachLookupAccessToGlobalName):
* testing/Internals.h:
* testing/Internals.idl:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253352 => 253353)
--- trunk/Source/WebCore/ChangeLog 2019-12-10 23:28:18 UTC (rev 253352)
+++ trunk/Source/WebCore/ChangeLog 2019-12-10 23:39:13 UTC (rev 253353)
@@ -1,3 +1,22 @@
+2019-12-10 Per Arne Vollan <[email protected]>
+
+ Make it possible to add regression tests for blocked XPC services
+ https://bugs.webkit.org/show_bug.cgi?id=204967
+
+ Reviewed by Brent Fulgham.
+
+ On macOS and iOS, it should be possible to add regression tests for blocked mach services. Add a method
+ to Internals, which checks whether a given process has access to mach lookup for a given global service
+ name. Currently, the only supported process is the WebContent process since the PIDs of other processes
+ are not readily available in Internals, but support for other processes will be added when needed.
+
+ No new tests, since this patch is in preparation for adding regression tests for sandbox changes.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::hasSandboxMachLookupAccessToGlobalName):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2019-12-10 Sihui Liu <[email protected]>
IndexedDB: remove timer for completed operation in IDBTransaction
Modified: trunk/Source/WebCore/testing/Internals.cpp (253352 => 253353)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-12-10 23:28:18 UTC (rev 253352)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-12-10 23:39:13 UTC (rev 253353)
@@ -303,6 +303,10 @@
#include "GraphicsContext3DManager.h"
#endif
+#if PLATFORM(COCOA)
+#import <wtf/spi/darwin/SandboxSPI.h>
+#endif
+
using JSC::CallData;
using JSC::CallType;
using JSC::CodeBlock;
@@ -5342,4 +5346,19 @@
return InternalsSetLike::create();
}
+bool Internals::hasSandboxMachLookupAccessToGlobalName(const String& process, const String& service)
+{
+#if PLATFORM(COCOA)
+ pid_t pid;
+ if (process == "com.apple.WebKit.WebContent")
+ pid = getpid();
+ else
+ RELEASE_ASSERT_NOT_REACHED();
+
+ return !sandbox_check(pid, "mach-lookup", static_cast<enum sandbox_filter_type>(SANDBOX_FILTER_GLOBAL_NAME | SANDBOX_CHECK_NO_REPORT), service.utf8().data());
+#else
+ return false;
+#endif
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/Internals.h (253352 => 253353)
--- trunk/Source/WebCore/testing/Internals.h 2019-12-10 23:28:18 UTC (rev 253352)
+++ trunk/Source/WebCore/testing/Internals.h 2019-12-10 23:39:13 UTC (rev 253353)
@@ -912,6 +912,8 @@
Ref<InternalsSetLike> createInternalsSetLike();
Ref<InternalsMapLike> createInternalsMapLike();
+
+ bool hasSandboxMachLookupAccessToGlobalName(const String& process, const String& service);
String highlightPseudoElementColor(const String& highlightName, Element&);
Modified: trunk/Source/WebCore/testing/Internals.idl (253352 => 253353)
--- trunk/Source/WebCore/testing/Internals.idl 2019-12-10 23:28:18 UTC (rev 253352)
+++ trunk/Source/WebCore/testing/Internals.idl 2019-12-10 23:39:13 UTC (rev 253353)
@@ -823,4 +823,6 @@
InternalsSetLike createInternalsSetLike();
DOMString highlightPseudoElementColor(DOMString highlightName, Element element);
+
+ boolean hasSandboxMachLookupAccessToGlobalName(DOMString process, DOMString service);
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes