Diff
Modified: trunk/Source/WTF/ChangeLog (275107 => 275108)
--- trunk/Source/WTF/ChangeLog 2021-03-26 19:16:41 UTC (rev 275107)
+++ trunk/Source/WTF/ChangeLog 2021-03-26 19:26:35 UTC (rev 275108)
@@ -1,3 +1,15 @@
+2021-03-26 Per Arne <[email protected]>
+
+ Enforce notifyd message filtering
+ https://bugs.webkit.org/show_bug.cgi?id=223601
+ <rdar://75098580>
+
+ Reviewed by Brent Fulgham.
+
+ Add ENABLE define for Notify filtering.
+
+ * wtf/PlatformEnableCocoa.h:
+
2021-03-26 Dean Jackson <[email protected]>
Enable Metal ANGLE backend for WebGL
Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (275107 => 275108)
--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2021-03-26 19:16:41 UTC (rev 275107)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h 2021-03-26 19:26:35 UTC (rev 275108)
@@ -661,3 +661,7 @@
#if !defined(ENABLE_SEPARATED_MODEL) && HAVE(UIKIT_WEBKIT_INTERNALS) && HAVE(CORE_ANIMATION_SEPARATED_LAYERS)
#define ENABLE_SEPARATED_MODEL 1
#endif
+
+#if !defined(ENABLE_NOTIFY_FILTERING) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
+#define ENABLE_NOTIFY_FILTERING 1
+#endif
Modified: trunk/Source/WebCore/PAL/ChangeLog (275107 => 275108)
--- trunk/Source/WebCore/PAL/ChangeLog 2021-03-26 19:16:41 UTC (rev 275107)
+++ trunk/Source/WebCore/PAL/ChangeLog 2021-03-26 19:26:35 UTC (rev 275108)
@@ -1,3 +1,16 @@
+2021-03-26 Per Arne <[email protected]>
+
+ Enforce notifyd message filtering
+ https://bugs.webkit.org/show_bug.cgi?id=223601
+ <rdar://75098580>
+
+ Reviewed by Brent Fulgham.
+
+ Add Notify SPI file.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/spi/cocoa/NotifySPI.h: Added.
+
2021-03-26 Devin Rousso <[email protected]>
Adopt AVKit SPI for hiding touch bar seeking controls
Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (275107 => 275108)
--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2021-03-26 19:16:41 UTC (rev 275107)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2021-03-26 19:26:35 UTC (rev 275108)
@@ -198,6 +198,7 @@
CDACB361238742740018D7CE /* MediaToolboxSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = CDACB35F23873E480018D7CE /* MediaToolboxSoftLink.h */; };
CDF91113220E4EEC001EA39E /* CelestialSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF91112220E4EEC001EA39E /* CelestialSPI.h */; };
CE5673872151A7B9002F92D7 /* IOKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5673862151A7B9002F92D7 /* IOKitSPI.h */; };
+ E327C0DF260BE436002281C5 /* NotifySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E327C0DE260BDC90002281C5 /* NotifySPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
E5D45D122106A07400D2B738 /* NSColorWellSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E5D45D112106A07400D2B738 /* NSColorWellSPI.h */; };
E5D45D142106A18700D2B738 /* NSPopoverColorWellSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E5D45D132106A18700D2B738 /* NSPopoverColorWellSPI.h */; };
EB8A8DC22509E87E00D1BF90 /* MediaToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = EB8A8DC12509E87E00D1BF90 /* MediaToolboxSPI.h */; };
@@ -410,6 +411,7 @@
CDACB35F23873E480018D7CE /* MediaToolboxSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaToolboxSoftLink.h; sourceTree = "<group>"; };
CDF91112220E4EEC001EA39E /* CelestialSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CelestialSPI.h; sourceTree = "<group>"; };
CE5673862151A7B9002F92D7 /* IOKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOKitSPI.h; sourceTree = "<group>"; };
+ E327C0DE260BDC90002281C5 /* NotifySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotifySPI.h; sourceTree = "<group>"; };
E5D45D112106A07400D2B738 /* NSColorWellSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSColorWellSPI.h; sourceTree = "<group>"; };
E5D45D132106A18700D2B738 /* NSPopoverColorWellSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSPopoverColorWellSPI.h; sourceTree = "<group>"; };
EB8A8DC12509E87E00D1BF90 /* MediaToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaToolboxSPI.h; sourceTree = "<group>"; };
@@ -510,6 +512,7 @@
EB8A8DC12509E87E00D1BF90 /* MediaToolboxSPI.h */,
1CC3ACE722BD7EB800F360F0 /* MetalSPI.h */,
0C2DA12D1F3BEB4900DBC317 /* NEFilterSourceSPI.h */,
+ E327C0DE260BDC90002281C5 /* NotifySPI.h */,
0C7785741F45130F00F4EBB6 /* NSAccessibilitySPI.h */,
0C2DA12E1F3BEB4900DBC317 /* NSAttributedStringSPI.h */,
0C2DA12F1F3BEB4900DBC317 /* NSButtonCellSPI.h */,
@@ -878,6 +881,7 @@
1CC3ACE822BD7EC500F360F0 /* MetalSPI.h in Headers */,
0C5AF91E1F43A4C7002EAC02 /* MobileGestaltSPI.h in Headers */,
0C2DA1491F3BEB4900DBC317 /* NEFilterSourceSPI.h in Headers */,
+ E327C0DF260BE436002281C5 /* NotifySPI.h in Headers */,
0C77858D1F45130F00F4EBB6 /* NSAccessibilitySPI.h in Headers */,
1CCEE4F720D8743F0047B097 /* NSAppearanceSPI.h in Headers */,
0C77858E1F45130F00F4EBB6 /* NSApplicationSPI.h in Headers */,
Added: trunk/Source/WebCore/PAL/pal/spi/cocoa/NotifySPI.h (0 => 275108)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/NotifySPI.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/NotifySPI.h 2021-03-26 19:26:35 UTC (rev 275108)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#define NOTIFY_OPT_DISPATCH 0x00000001
+#define NOTIFY_OPT_REGEN 0x00000002
+#define NOTIFY_OPT_FILTERED 0x00000004
Modified: trunk/Source/WebKit/ChangeLog (275107 => 275108)
--- trunk/Source/WebKit/ChangeLog 2021-03-26 19:16:41 UTC (rev 275107)
+++ trunk/Source/WebKit/ChangeLog 2021-03-26 19:26:35 UTC (rev 275108)
@@ -1,3 +1,16 @@
+2021-03-26 Per Arne <[email protected]>
+
+ Enforce notifyd message filtering
+ https://bugs.webkit.org/show_bug.cgi?id=223601
+ <rdar://75098580>
+
+ Reviewed by Brent Fulgham.
+
+ Enable Notify filtering by setting Notify options before entering sandbox.
+
+ * Shared/mac/AuxiliaryProcessMac.mm:
+ (WebKit::compileAndApplySandboxSlowCase):
+
2021-03-26 Commit Queue <[email protected]>
Unreviewed, reverting r274938.
Modified: trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm (275107 => 275108)
--- trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm 2021-03-26 19:16:41 UTC (rev 275107)
+++ trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm 2021-03-26 19:26:35 UTC (rev 275108)
@@ -43,6 +43,7 @@
#import <pal/crypto/CryptoDigest.h>
#import <pal/spi/cocoa/CoreServicesSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
+#import <pal/spi/cocoa/NotifySPI.h>
#import <pwd.h>
#import <stdlib.h>
#import <sys/sysctl.h>
@@ -66,6 +67,11 @@
SOFT_LINK_SYSTEM_LIBRARY(libsystem_info)
SOFT_LINK_OPTIONAL(libsystem_info, mbr_close_connections, int, (), ());
+#if ENABLE(NOTIFY_FILTERING)
+SOFT_LINK_SYSTEM_LIBRARY(libsystem_notify)
+SOFT_LINK_OPTIONAL(libsystem_notify, notify_set_options, void, __cdecl, (uint32_t));
+#endif
+
#if PLATFORM(MAC)
#define USE_CACHE_COMPILED_SANDBOX 1
#else
@@ -180,6 +186,14 @@
#endif
}
+static void setNotifyOptions()
+{
+#if ENABLE(NOTIFY_FILTERING)
+ if (notify_set_optionsPtr())
+ notify_set_optionsPtr()(NOTIFY_OPT_DISPATCH | NOTIFY_OPT_REGEN | NOTIFY_OPT_FILTERED);
+#endif
+}
+
#if USE(CACHE_COMPILED_SANDBOX)
static Optional<Vector<char>> fileContents(const String& path, bool shouldLock = false, OptionSet<FileSystem::FileLockMode> lockMode = FileSystem::FileLockMode::Exclusive)
{
@@ -506,6 +520,8 @@
ASSERT(static_cast<void *>(sandboxDataPtr + profile.size) <= static_cast<void *>(cachedSandboxContents.data() + cachedSandboxContents.size()));
profile.data = ""
+ setNotifyOptions();
+
if (sandbox_apply(&profile)) {
WTFLogAlways("%s: Could not apply cached sandbox: %s\n", getprogname(), strerror(errno));
return false;
@@ -544,6 +560,9 @@
char* errorBuf;
CString temp = isProfilePath ? FileSystem::fileSystemRepresentation(profileOrProfilePath) : profileOrProfilePath.utf8();
uint64_t flags = isProfilePath ? SANDBOX_NAMED_EXTERNAL : 0;
+
+ setNotifyOptions();
+
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
if (sandbox_init_with_parameters(temp.data(), flags, parameters.namedParameterArray(), &errorBuf)) {
ALLOW_DEPRECATED_DECLARATIONS_END
@@ -603,6 +622,8 @@
if (!sandboxProfile)
return compileAndApplySandboxSlowCase(profileOrProfilePath, isProfilePath, sandboxInitializationParameters);
+ setNotifyOptions();
+
if (sandbox_apply(sandboxProfile.get())) {
WTFLogAlways("%s: Could not apply compiled sandbox: %s\n", getprogname(), strerror(errno));
CRASH();