Title: [272831] trunk/Source
Revision
272831
Author
[email protected]
Date
2021-02-13 02:12:08 -0800 (Sat, 13 Feb 2021)

Log Message

[JSC] Enable JITCage on macOS
https://bugs.webkit.org/show_bug.cgi?id=221805
<rdar://problem/74153806>

Reviewed by Mark Lam.

Source/_javascript_Core:

We enable JITCage too on macOS if it is ARM64E.
We need to add this entitlement only when building it on macOS 120000 or higher version.
Otherwise, we cannot launch the process. This means that we need to dynamically generate entitlements file
because we must not attach this entitlement when building JSC for non 120000 macOS.

This patch follows r248164's way: we must not use CODE_SIGN_ENTITLEMENTS because XCode inserts implicit code-signing
and it breaks our pipeline. We need to disable this XCode's implicit behavior by setting CODE_SIGN_INJECT_BASE_ENTITLEMENTS.

And we also create TestAPI.xcconfig to apply generated entitlements only to testapi and jsc shell.

* Configurations/Base.xcconfig:
* Configurations/JSC.xcconfig:
* Configurations/TestAPI.xcconfig: Copied from Source/_javascript_Core/Configurations/ToolExecutable.xcconfig.
* Configurations/ToolExecutable.xcconfig:
* _javascript_Core.xcodeproj/project.pbxproj:
* Scripts/process-entitlements.sh: Added.
* allow-jit-macOS.entitlements: Removed.
* testapi.entitlements: Removed.

Source/WebKit:

We need to add this entitlement only when building it on macOS 120000 or higher version.
Otherwise, we cannot launch the process. And we attach this entitlement only when building processes
with Apple Internal SDKs.

* Scripts/process-entitlements.sh:

Source/WTF:

Enable JIT_CAGE when macOS is 120000 or higher with ARM64E.

* wtf/PlatformEnable.h:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (272830 => 272831)


--- trunk/Source/_javascript_Core/ChangeLog	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-02-13 10:12:08 UTC (rev 272831)
@@ -1,3 +1,30 @@
+2021-02-12  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable JITCage on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=221805
+        <rdar://problem/74153806>
+
+        Reviewed by Mark Lam.
+
+        We enable JITCage too on macOS if it is ARM64E.
+        We need to add this entitlement only when building it on macOS 120000 or higher version.
+        Otherwise, we cannot launch the process. This means that we need to dynamically generate entitlements file
+        because we must not attach this entitlement when building JSC for non 120000 macOS.
+
+        This patch follows r248164's way: we must not use CODE_SIGN_ENTITLEMENTS because XCode inserts implicit code-signing
+        and it breaks our pipeline. We need to disable this XCode's implicit behavior by setting CODE_SIGN_INJECT_BASE_ENTITLEMENTS.
+
+        And we also create TestAPI.xcconfig to apply generated entitlements only to testapi and jsc shell.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/JSC.xcconfig:
+        * Configurations/TestAPI.xcconfig: Copied from Source/_javascript_Core/Configurations/ToolExecutable.xcconfig.
+        * Configurations/ToolExecutable.xcconfig:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * Scripts/process-entitlements.sh: Added.
+        * allow-jit-macOS.entitlements: Removed.
+        * testapi.entitlements: Removed.
+
 2021-02-12  Mark Lam  <[email protected]>
 
         Rename `slotVisitor` variables to `visitor`.

Modified: trunk/Source/_javascript_Core/Configurations/Base.xcconfig (272830 => 272831)


--- trunk/Source/_javascript_Core/Configurations/Base.xcconfig	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/Configurations/Base.xcconfig	2021-02-13 10:12:08 UTC (rev 272831)
@@ -219,3 +219,6 @@
 WK_USE_NEW_BUILD_SYSTEM = $(WK_USE_NEW_BUILD_SYSTEM_$(WK_WHICH_BUILD_SYSTEM))
 WK_USE_NEW_BUILD_SYSTEM_legacy = NO
 WK_USE_NEW_BUILD_SYSTEM_not_legacy = YES
+
+WK_PROCESSED_XCENT_FILE=$(TEMP_FILE_DIR)/$(FULL_PRODUCT_NAME).entitlements
+WK_USE_RESTRICTED_ENTITLEMENTS = $(USE_INTERNAL_SDK);

Modified: trunk/Source/_javascript_Core/Configurations/JSC.xcconfig (272830 => 272831)


--- trunk/Source/_javascript_Core/Configurations/JSC.xcconfig	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/Configurations/JSC.xcconfig	2021-02-13 10:12:08 UTC (rev 272831)
@@ -30,10 +30,13 @@
 WK_RELOCATABLE_FRAMEWORKS_LDFLAGS_YES = -Wl,-dyld_env,DYLD_FRAMEWORK_PATH=@executable_path/../../../..;
 
 PRODUCT_NAME = jsc;
-CODE_SIGN_ENTITLEMENTS[sdk=iphone*] = entitlements.plist;
-CODE_SIGN_ENTITLEMENTS[sdk=macosx*] = allow-jit-macOS.entitlements;
-OTHER_CODE_SIGN_FLAGS[sdk=iphone*] = -i com.apple.jsc;
 
+// We want this to always be NO. If set to YES, Xcode will invoke codesign with an --entitlements parameter that points to the platform's BaseEntitlements.plist. This parameter would override any --entitlements parameter that we establish in WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS, causing our entitlements to be ignored.
+CODE_SIGN_INJECT_BASE_ENTITLEMENTS[sdk=iphone*] = NO;
+CODE_SIGN_INJECT_BASE_ENTITLEMENTS[sdk=macosx*] = NO;
+OTHER_CODE_SIGN_FLAGS[sdk=iphone*] = -i com.apple.jsc --entitlements ${WK_PROCESSED_XCENT_FILE};
+OTHER_CODE_SIGN_FLAGS[sdk=macosx*] = --entitlements ${WK_PROCESSED_XCENT_FILE};
+
 // Explicitly add the PrivateHeaders directory to the search path so that generated header files can be found in production builds.
 HEADER_SEARCH_PATHS = "$(_javascript_CORE_FRAMEWORKS_DIR)/_javascript_Core.framework/PrivateHeaders" $(inherited);
 HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core" $(HEADER_SEARCH_PATHS);

Copied: trunk/Source/_javascript_Core/Configurations/TestAPI.xcconfig (from rev 272830, trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig) (0 => 272831)


--- trunk/Source/_javascript_Core/Configurations/TestAPI.xcconfig	                        (rev 0)
+++ trunk/Source/_javascript_Core/Configurations/TestAPI.xcconfig	2021-02-13 10:12:08 UTC (rev 272831)
@@ -0,0 +1,51 @@
+// Copyright (C) 2011-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. ``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
+// 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.
+
+#include? "../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
+#include "Version.xcconfig"
+
+INSTALL_PATH = $(_javascript_CORE_FRAMEWORKS_DIR)/$(_javascript_CORE_HELPERS_DIR);
+PRODUCT_NAME = $(TARGET_NAME);
+
+USE_INTERNAL_SDK = $(USE_INTERNAL_SDK_$(CONFIGURATION));
+USE_INTERNAL_SDK_Production = YES;
+USE_INTERNAL_SDK_Debug = $(HAVE_INTERNAL_SDK);
+USE_INTERNAL_SDK_Release = $(HAVE_INTERNAL_SDK);
+
+// We want this to always be NO. If set to YES, Xcode will invoke codesign with an --entitlements parameter that points to the platform's BaseEntitlements.plist. This parameter would override any --entitlements parameter that we establish in WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS, causing our entitlements to be ignored.
+CODE_SIGN_INJECT_BASE_ENTITLEMENTS[sdk=iphone*] = NO;
+CODE_SIGN_INJECT_BASE_ENTITLEMENTS[sdk=macosx*] = NO;
+OTHER_CODE_SIGN_FLAGS[sdk=iphone*] = -i com.apple.jsc --entitlements ${WK_PROCESSED_XCENT_FILE};
+OTHER_CODE_SIGN_FLAGS[sdk=macosx*] = --entitlements ${WK_PROCESSED_XCENT_FILE};
+
+SKIP_INSTALL = $(SKIP_INSTALL_$(FORCE_TOOL_INSTALL));
+SKIP_INSTALL_ = YES;
+SKIP_INSTALL_NO = YES;
+SKIP_INSTALL_YES = NO;
+
+CLANG_ENABLE_OBJC_ARC = YES;
+
+OTHER_CFLAGS = $(inherited) -isystem icu;
+
+// Explicitly add the PrivateHeaders directory to the search path so that generated header files can be found in production builds.
+HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core" "${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}" "$(_javascript_CORE_FRAMEWORKS_DIR)/_javascript_Core.framework/PrivateHeaders" $(inherited);

Modified: trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig (272830 => 272831)


--- trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/Configurations/ToolExecutable.xcconfig	2021-02-13 10:12:08 UTC (rev 272831)
@@ -33,12 +33,10 @@
 USE_INTERNAL_SDK_Release = $(HAVE_INTERNAL_SDK);
 
 CODE_SIGN_ENTITLEMENTS[sdk=macosx*] = $(CODE_SIGN_ENTITLEMENTS_macosx_$(TARGET_NAME)_$(USE_INTERNAL_SDK));
-CODE_SIGN_ENTITLEMENTS_macosx_testapi_YES = testapi.entitlements;
 
 CODE_SIGN_ENTITLEMENTS[sdk=iphone*] = $(CODE_SIGN_ENTITLEMENTS_ios_$(TARGET_NAME));
 CODE_SIGN_ENTITLEMENTS_ios_minidom = entitlements.plist;
 CODE_SIGN_ENTITLEMENTS_ios_testair = entitlements.plist;
-CODE_SIGN_ENTITLEMENTS_ios_testapi = entitlements.plist;
 CODE_SIGN_ENTITLEMENTS_ios_testb3 = entitlements.plist;
 CODE_SIGN_ENTITLEMENTS_ios_testmasm = entitlements.plist;
 CODE_SIGN_ENTITLEMENTS_ios_testWasm = entitlements.plist;

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (272830 => 272831)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2021-02-13 10:12:08 UTC (rev 272831)
@@ -3382,7 +3382,6 @@
 		144CA34F221F037900817789 /* CachedBytecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedBytecode.h; sourceTree = "<group>"; };
 		1450FA1D2357BEC40093CD4D /* WasmLLIntTierUpCounter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WasmLLIntTierUpCounter.cpp; sourceTree = "<group>"; };
 		1450FA1E2357BEC40093CD4D /* WasmLLIntTierUpCounter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WasmLLIntTierUpCounter.h; sourceTree = "<group>"; };
-		145348572291737F00B1C2EB /* testapi.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = testapi.entitlements; sourceTree = "<group>"; };
 		145722851437E140005FDE26 /* StrongInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StrongInlines.h; sourceTree = "<group>"; };
 		145C507F0D9DF63B0088F6B9 /* CallData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallData.h; sourceTree = "<group>"; };
 		145FF2C6243BB99A00569E71 /* ECMAMode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ECMAMode.cpp; sourceTree = "<group>"; };
@@ -4096,7 +4095,6 @@
 		79D5CD581C1106A900CECA07 /* SamplingProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SamplingProfiler.cpp; sourceTree = "<group>"; };
 		79D5CD591C1106A900CECA07 /* SamplingProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingProfiler.h; sourceTree = "<group>"; };
 		79D7B0E121152FD200FE7C64 /* entitlements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = entitlements.plist; sourceTree = "<group>"; };
-		79D7B0E221152FD300FE7C64 /* allow-jit-macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "allow-jit-macOS.entitlements"; sourceTree = "<group>"; };
 		79DAE2791E03C82200B526AA /* WasmExceptionType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmExceptionType.h; sourceTree = "<group>"; };
 		79DFCBDA1D88C59600527D03 /* HasOwnPropertyCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HasOwnPropertyCache.h; sourceTree = "<group>"; };
 		79EE0BFD1B4AFB85000385C9 /* VariableEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariableEnvironment.cpp; sourceTree = "<group>"; };
@@ -5162,8 +5160,10 @@
 		E3D2642A1D38C042000BE174 /* BytecodeRewriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeRewriter.h; sourceTree = "<group>"; };
 		E3D3515D241B89CE008DC16E /* MarkedJSValueRefArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MarkedJSValueRefArray.h; sourceTree = "<group>"; };
 		E3D3515E241B89CF008DC16E /* MarkedJSValueRefArray.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedJSValueRefArray.cpp; sourceTree = "<group>"; };
+		E3D6F6EF25D791B300C20EB4 /* TestAPI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TestAPI.xcconfig; sourceTree = "<group>"; };
 		E3D877711E65C08900BE945A /* BytecodeDumper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BytecodeDumper.cpp; sourceTree = "<group>"; };
 		E3D877721E65C08900BE945A /* BytecodeDumper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeDumper.h; sourceTree = "<group>"; };
+		E3E9F8D525D7582F00F9F84B /* process-entitlements.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "process-entitlements.sh"; sourceTree = "<group>"; };
 		E3EE137421FBD43400D83C4B /* ErrorType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorType.h; sourceTree = "<group>"; };
 		E3EE137521FBD43400D83C4B /* ErrorType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorType.cpp; sourceTree = "<group>"; };
 		E3F2192F24C78829003AE453 /* IntlSegmentIteratorPrototype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IntlSegmentIteratorPrototype.h; sourceTree = "<group>"; };
@@ -5541,9 +5541,7 @@
 				F5C290E60284F98E018635CA /* _javascript_CorePrefix.h */,
 				45E12D8806A49B0F00E9DF84 /* jsc.cpp */,
 				A7C225CC139981F100FF1662 /* KeywordLookupGenerator.py */,
-				79D7B0E221152FD300FE7C64 /* allow-jit-macOS.entitlements */,
 				79D7B0E121152FD200FE7C64 /* entitlements.plist */,
-				145348572291737F00B1C2EB /* testapi.entitlements */,
 				1432EBD70A34CAD400717B9F /* API */,
 				9688CB120ED12B4E001D649F /* assembler */,
 				0FEC84B21BDACD5E0080FF74 /* b3 */,
@@ -6622,6 +6620,7 @@
 				1C9051430BA9E8A70081E9D0 /* _javascript_Core.xcconfig */,
 				5DAFD6CB146B686300FBEFB4 /* JSC.xcconfig */,
 				A1B89B88221E002A00EB4CEA /* SDKVariant.xcconfig */,
+				E3D6F6EF25D791B300C20EB4 /* TestAPI.xcconfig */,
 				BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */,
 				1C9051420BA9E8A70081E9D0 /* Version.xcconfig */,
 				37119A7720CCB5DC002C6DC9 /* WebKitTargetConditionals.xcconfig */,
@@ -8647,6 +8646,7 @@
 				9959E9291BD17FA0001AA413 /* jsmin.py */,
 				99DA00AD1BD5993E00F4575C /* lazywriter.py */,
 				A5EF13F71F0731B4000F0442 /* make-js-file-arrays.py */,
+				E3E9F8D525D7582F00F9F84B /* process-entitlements.sh */,
 				99DA00AE1BD5993E00F4575C /* UpdateContents.py */,
 				9959E92A1BD17FA0001AA413 /* xxd.pl */,
 			);
@@ -10400,6 +10400,7 @@
 				992F56B71E4E84B20035953B /* RemoteInspectorXPCConnection.h in Headers */,
 				0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
 				869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
+				FE3B642F25D6FB4D001ADDB4 /* RootMarkReason.h in Headers */,
 				0F2C63AA1E4FA42E00C13839 /* RunningScope.h in Headers */,
 				70B0A9D11A9B66460001306A /* RuntimeFlags.h in Headers */,
 				52C0611F1AA51E1C00B4ADBA /* RuntimeType.h in Headers */,
@@ -10549,7 +10550,6 @@
 				99DA00B11BD5994E00F4575C /* UpdateContents.py in Headers */,
 				0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */,
 				0F426A481460CBB300131F8F /* ValueRecovery.h in Headers */,
-				FE3B642F25D6FB4D001ADDB4 /* RootMarkReason.h in Headers */,
 				79EE0C001B4AFB85000385C9 /* VariableEnvironment.h in Headers */,
 				0F6C73511AC9F99F00BE1682 /* VariableWriteFireDetail.h in Headers */,
 				0FE0502D1AA9095600D33B33 /* VarOffset.h in Headers */,
@@ -10787,6 +10787,7 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 14BD59D60A3E8FC900BAF59C /* Build configuration list for PBXNativeTarget "testapi" */;
 			buildPhases = (
+				E3D6F6EE25D78CF600C20EB4 /* Generate Entitlements */,
 				14BD59BC0A3E8F9000BAF59C /* Sources */,
 				14BD59BD0A3E8F9000BAF59C /* Frameworks */,
 				5366FDB222D5485B00BF94AF /* Copy Support Scripts */,
@@ -10908,6 +10909,7 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 149C276708902AFE008A9EFC /* Build configuration list for PBXNativeTarget "jsc" */;
 			buildPhases = (
+				E3D6F6ED25D78C0100C20EB4 /* Generate Entitlements */,
 				932F5BDC0822A1C700736975 /* Sources */,
 				932F5BDE0822A1C700736975 /* Frameworks */,
 				5D5D8ABF0E0D0B0300F9C692 /* Create /usr/local/bin/jsc symlink */,
@@ -11330,6 +11332,46 @@
 			shellPath = /bin/sh;
 			shellScript = "UNLOCK_SCRIPT_PATH=\"${SRCROOT}/../../../Internal/Tools/Scripts/unlock-safari-engineering-keychain-if-needed\"\n\n[[ -x \"${UNLOCK_SCRIPT_PATH}\" ]] && exec \"${UNLOCK_SCRIPT_PATH}\"\n\nexit 0\n";
 		};
+		E3D6F6ED25D78C0100C20EB4 /* Generate Entitlements */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+				"$(SRCROOT)/Scripts/process-entitlements.sh",
+			);
+			name = "Generate Entitlements";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+				"$(WK_PROCESSED_XCENT_FILE)",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "Scripts/process-entitlements.sh\n";
+		};
+		E3D6F6EE25D78CF600C20EB4 /* Generate Entitlements */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+				"$(SRCROOT)/Scripts/process-entitlements.sh",
+			);
+			name = "Generate Entitlements";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+				"$(WK_PROCESSED_XCENT_FILE)",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "Scripts/process-entitlements.sh\n";
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
@@ -12064,7 +12106,7 @@
 		};
 		14BD59D70A3E8FC900BAF59C /* Debug */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+			baseConfigurationReference = E3D6F6EF25D791B300C20EB4 /* TestAPI.xcconfig */;
 			buildSettings = {
 			};
 			name = Debug;
@@ -12071,7 +12113,7 @@
 		};
 		14BD59D80A3E8FC900BAF59C /* Release */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+			baseConfigurationReference = E3D6F6EF25D791B300C20EB4 /* TestAPI.xcconfig */;
 			buildSettings = {
 			};
 			name = Release;
@@ -12078,7 +12120,7 @@
 		};
 		14BD59D90A3E8FC900BAF59C /* Production */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+			baseConfigurationReference = E3D6F6EF25D791B300C20EB4 /* TestAPI.xcconfig */;
 			buildSettings = {
 			};
 			name = Production;
@@ -12459,7 +12501,7 @@
 		};
 		A76148420E6402F700E357FA /* Profiling */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */;
+			baseConfigurationReference = E3D6F6EF25D791B300C20EB4 /* TestAPI.xcconfig */;
 			buildSettings = {
 			};
 			name = Profiling;

Added: trunk/Source/_javascript_Core/Scripts/process-entitlements.sh (0 => 272831)


--- trunk/Source/_javascript_Core/Scripts/process-entitlements.sh	                        (rev 0)
+++ trunk/Source/_javascript_Core/Scripts/process-entitlements.sh	2021-02-13 10:12:08 UTC (rev 272831)
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+function plistbuddy()
+{
+    /usr/libexec/PlistBuddy -c "$*" "${WK_PROCESSED_XCENT_FILE}"
+}
+
+# ========================================
+# Mac entitlements
+# ========================================
+
+function mac_process_jsc_entitlements()
+{
+    plistbuddy Add :com.apple.security.cs.allow-jit bool YES
+    if [[ "${WK_USE_RESTRICTED_ENTITLEMENTS}" == YES ]]
+    then
+        if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+        then
+            plistbuddy Add :com.apple.private.securejit bool YES
+        fi
+    fi
+}
+
+function mac_process_testapi_entitlements()
+{
+    if [[ "${WK_USE_RESTRICTED_ENTITLEMENTS}" == YES ]]
+    then
+        plistbuddy Add :com.apple.security.cs.allow-jit bool YES
+        plistbuddy Add :com.apple.rootless.storage._javascript_Core bool YES
+        if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+        then
+            plistbuddy Add :com.apple.private.securejit bool YES
+        fi
+    fi
+}
+
+# ========================================
+# macCatalyst entitlements
+# ========================================
+
+function maccatalyst_process_jsc_entitlements()
+{
+    plistbuddy Add :com.apple.security.cs.allow-jit bool YES
+    if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+    then
+        plistbuddy Add :com.apple.private.securejit bool YES
+    fi
+}
+
+function maccatalyst_process_testapi_entitlements()
+{
+    plistbuddy Add :com.apple.rootless.storage._javascript_Core bool YES
+    plistbuddy Add :com.apple.security.cs.allow-jit bool YES
+    if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+    then
+        plistbuddy Add :com.apple.private.securejit bool YES
+    fi
+}
+
+# ========================================
+# iOS Family entitlements
+# ========================================
+
+function ios_family_process_jsc_entitlements()
+{
+    plistbuddy Add :com.apple.private.securejit bool YES
+    plistbuddy Add :dynamic-codesigning bool YES
+}
+
+function ios_family_process_testapi_entitlements()
+{
+    ios_family_process_jsc_entitlements
+}
+
+rm -f "${WK_PROCESSED_XCENT_FILE}"
+plistbuddy Clear dict
+
+if [[ "${WK_PLATFORM_NAME}" =~ .*simulator ]]
+then
+    [[ "${RC_XBS}" != YES ]] && plistbuddy Add :com.apple.security.get-task-allow bool YES
+elif [[ "${WK_PLATFORM_NAME}" == macosx ]]
+then
+    [[ "${RC_XBS}" != YES ]] && plistbuddy Add :com.apple.security.get-task-allow bool YES
+
+    if [[ "${PRODUCT_NAME}" == jsc ]]; then mac_process_jsc_entitlements
+    elif [[ "${PRODUCT_NAME}" == testapi ]]; then mac_process_testapi_entitlements
+    else echo "Unsupported/unknown product: ${PRODUCT_NAME}"
+    fi
+elif [[ "${WK_PLATFORM_NAME}" == maccatalyst || "${WK_PLATFORM_NAME}" == iosmac ]]
+then
+    [[ "${RC_XBS}" != YES && "${PRODUCT_NAME}" == jsc ]] && plistbuddy Add :com.apple.security.get-task-allow bool YES
+
+    if [[ "${PRODUCT_NAME}" == jsc ]]; then maccatalyst_process_jsc_entitlements
+    elif [[ "${PRODUCT_NAME}" == testapi ]]; then maccatalyst_process_testapi_entitlements
+    else echo "Unsupported/unknown product: ${PRODUCT_NAME}"
+    fi
+elif [[ "${WK_PLATFORM_NAME}" == iphoneos ||
+        "${WK_PLATFORM_NAME}" == appletvos ||
+        "${WK_PLATFORM_NAME}" == watchos ]]
+then
+    if [[ "${PRODUCT_NAME}" == jsc ]]; then ios_family_process_jsc_entitlements
+    elif [[ "${PRODUCT_NAME}" == testapi ]]; then ios_family_process_testapi_entitlements
+    else echo "Unsupported/unknown product: ${PRODUCT_NAME}"
+    fi
+else
+    echo "Unsupported/unknown platform: ${WK_PLATFORM_NAME}"
+fi
+
+exit 0
Property changes on: trunk/Source/_javascript_Core/Scripts/process-entitlements.sh
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/Source/_javascript_Core/allow-jit-macOS.entitlements (272830 => 272831)


--- trunk/Source/_javascript_Core/allow-jit-macOS.entitlements	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/allow-jit-macOS.entitlements	2021-02-13 10:12:08 UTC (rev 272831)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>com.apple.security.cs.allow-jit</key>
-	<true/>
-</dict>
-</plist>

Deleted: trunk/Source/_javascript_Core/testapi.entitlements (272830 => 272831)


--- trunk/Source/_javascript_Core/testapi.entitlements	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/_javascript_Core/testapi.entitlements	2021-02-13 10:12:08 UTC (rev 272831)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>com.apple.security.cs.allow-jit</key>
-	<true/>
-	<key>com.apple.rootless.storage._javascript_Core</key>
-	<true/>
-</dict>
-</plist>

Modified: trunk/Source/WTF/ChangeLog (272830 => 272831)


--- trunk/Source/WTF/ChangeLog	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/WTF/ChangeLog	2021-02-13 10:12:08 UTC (rev 272831)
@@ -1,3 +1,15 @@
+2021-02-12  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable JITCage on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=221805
+        <rdar://problem/74153806>
+
+        Reviewed by Mark Lam.
+
+        Enable JIT_CAGE when macOS is 120000 or higher with ARM64E.
+
+        * wtf/PlatformEnable.h:
+
 2021-02-12  Michael Saboff  <[email protected]>
 
         [ARM64e] Harden Mach exception handling

Modified: trunk/Source/WTF/wtf/PlatformEnable.h (272830 => 272831)


--- trunk/Source/WTF/wtf/PlatformEnable.h	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/WTF/wtf/PlatformEnable.h	2021-02-13 10:12:08 UTC (rev 272831)
@@ -887,7 +887,7 @@
 #error "ENABLE(WHLSL_COMPILER) requires ENABLE(WEBGPU)"
 #endif
 
-#if OS(DARWIN) && ENABLE(JIT) && USE(APPLE_INTERNAL_SDK) && CPU(ARM64E) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000
+#if OS(DARWIN) && ENABLE(JIT) && USE(APPLE_INTERNAL_SDK) && CPU(ARM64E) && ((defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000))
 #define ENABLE_JIT_CAGE 1
 #endif
 

Modified: trunk/Source/WebKit/ChangeLog (272830 => 272831)


--- trunk/Source/WebKit/ChangeLog	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/WebKit/ChangeLog	2021-02-13 10:12:08 UTC (rev 272831)
@@ -1,3 +1,17 @@
+2021-02-12  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable JITCage on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=221805
+        <rdar://problem/74153806>
+
+        Reviewed by Mark Lam.
+
+        We need to add this entitlement only when building it on macOS 120000 or higher version.
+        Otherwise, we cannot launch the process. And we attach this entitlement only when building processes
+        with Apple Internal SDKs.
+
+        * Scripts/process-entitlements.sh:
+
 2021-02-12  Chris Dumez  <[email protected]>
 
         Reduce explicit usage of [objC release] in WebKit

Modified: trunk/Source/WebKit/Scripts/process-entitlements.sh (272830 => 272831)


--- trunk/Source/WebKit/Scripts/process-entitlements.sh	2021-02-13 05:30:58 UTC (rev 272830)
+++ trunk/Source/WebKit/Scripts/process-entitlements.sh	2021-02-13 10:12:08 UTC (rev 272831)
@@ -26,6 +26,10 @@
             plistbuddy Add :com.apple.private.security.message-filter bool YES
             plistbuddy Add :com.apple.avfoundation.allow-system-wide-context bool YES
         fi
+        if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+        then
+            plistbuddy Add :com.apple.private.securejit bool YES
+        fi
     fi
 
     mac_process_webcontent_or_plugin_entitlements
@@ -104,6 +108,14 @@
     plistbuddy Add :com.apple.security.files.user-selected.read-write      bool YES
     plistbuddy Add :com.apple.security.print                               bool YES
 
+    if [[ "${WK_USE_RESTRICTED_ENTITLEMENTS}" == YES ]]
+    then
+        if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+        then
+            plistbuddy Add :com.apple.private.securejit bool YES
+        fi
+    fi
+
     mac_process_webcontent_or_plugin_entitlements
 }
 
@@ -147,6 +159,10 @@
         plistbuddy Add :com.apple.private.security.message-filter bool YES
         plistbuddy Add :com.apple.UIKit.view-service-wants-custom-idiom-and-scale bool YES
     fi
+    if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+    then
+        plistbuddy Add :com.apple.private.securejit bool YES
+    fi
 }
 
 function maccatalyst_process_gpu_entitlements()
@@ -174,6 +190,10 @@
     plistbuddy Add :com.apple.security.cs.disable-library-validation       bool YES
     plistbuddy Add :com.apple.security.files.user-selected.read-write      bool YES
     plistbuddy Add :com.apple.security.print                               bool YES
+    if (( "${TARGET_MAC_OS_X_VERSION_MAJOR}" >= 120000 ))
+    then
+        plistbuddy Add :com.apple.private.securejit bool YES
+    fi
 }
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to