- Revision
- 282980
- Author
- [email protected]
- Date
- 2021-09-23 12:15:03 -0700 (Thu, 23 Sep 2021)
Log Message
Cherry-pick r282009. rdar://problem/83430109
[JSC] Fix WebKitAdditions directory traversal in offlineasm part 2
https://bugs.webkit.org/show_bug.cgi?id=229853
Reviewed by Mark Lam.
When DEPLOYMENT_LOCATION is YES, WEBKITADDITIONS_HEADERS_FOLDER_PATH is /usr/local/include/WebKitAdditions.
However, since Xcode implicitly changes it to ${SDKROOT}/usr/local/include/WebKitAdditions, we need to
pass the path with ${SDKROOT} if this path is used by non-Xcode.
In this patch, we replace --use-deployment-location with --webkit-additions-path=path and passing WebKitAdditions
path directly from Xcode. We define WK_WEBKITADDITIONS_INSTALL_PATH and WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH in
_javascript_Core/Configurations/Base.xcconfig to populate this variable and pass WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH
to the scripts.
We also fix offlineasm's path concatenation. It was using +, but this does not work if directory doesn't end with '/'.
We should use File.join when concatenating file paths.
* Configurations/Base.xcconfig:
* _javascript_Core.xcodeproj/project.pbxproj:
* offlineasm/asm.rb:
* offlineasm/generate_offset_extractor.rb:
* offlineasm/generate_settings_extractor.rb:
* offlineasm/parser.rb:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282009 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-612-branch/Source/_javascript_Core/ChangeLog (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/ChangeLog 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/ChangeLog 2021-09-23 19:15:03 UTC (rev 282980)
@@ -1,3 +1,59 @@
+2021-09-23 Alan Coon <[email protected]>
+
+ Cherry-pick r282009. rdar://problem/83430109
+
+ [JSC] Fix WebKitAdditions directory traversal in offlineasm part 2
+ https://bugs.webkit.org/show_bug.cgi?id=229853
+
+ Reviewed by Mark Lam.
+
+ When DEPLOYMENT_LOCATION is YES, WEBKITADDITIONS_HEADERS_FOLDER_PATH is /usr/local/include/WebKitAdditions.
+ However, since Xcode implicitly changes it to ${SDKROOT}/usr/local/include/WebKitAdditions, we need to
+ pass the path with ${SDKROOT} if this path is used by non-Xcode.
+
+ In this patch, we replace --use-deployment-location with --webkit-additions-path=path and passing WebKitAdditions
+ path directly from Xcode. We define WK_WEBKITADDITIONS_INSTALL_PATH and WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH in
+ _javascript_Core/Configurations/Base.xcconfig to populate this variable and pass WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH
+ to the scripts.
+
+ We also fix offlineasm's path concatenation. It was using +, but this does not work if directory doesn't end with '/'.
+ We should use File.join when concatenating file paths.
+
+ * Configurations/Base.xcconfig:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * offlineasm/asm.rb:
+ * offlineasm/generate_offset_extractor.rb:
+ * offlineasm/generate_settings_extractor.rb:
+ * offlineasm/parser.rb:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282009 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-03 Yusuke Suzuki <[email protected]>
+
+ [JSC] Fix WebKitAdditions directory traversal in offlineasm part 2
+ https://bugs.webkit.org/show_bug.cgi?id=229853
+
+ Reviewed by Mark Lam.
+
+ When DEPLOYMENT_LOCATION is YES, WEBKITADDITIONS_HEADERS_FOLDER_PATH is /usr/local/include/WebKitAdditions.
+ However, since Xcode implicitly changes it to ${SDKROOT}/usr/local/include/WebKitAdditions, we need to
+ pass the path with ${SDKROOT} if this path is used by non-Xcode.
+
+ In this patch, we replace --use-deployment-location with --webkit-additions-path=path and passing WebKitAdditions
+ path directly from Xcode. We define WK_WEBKITADDITIONS_INSTALL_PATH and WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH in
+ _javascript_Core/Configurations/Base.xcconfig to populate this variable and pass WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH
+ to the scripts.
+
+ We also fix offlineasm's path concatenation. It was using +, but this does not work if directory doesn't end with '/'.
+ We should use File.join when concatenating file paths.
+
+ * Configurations/Base.xcconfig:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * offlineasm/asm.rb:
+ * offlineasm/generate_offset_extractor.rb:
+ * offlineasm/generate_settings_extractor.rb:
+ * offlineasm/parser.rb:
+
2021-09-22 Alan Coon <[email protected]>
Cherry-pick r281972. rdar://problem/83429723
Modified: branches/safari-612-branch/Source/_javascript_Core/Configurations/Base.xcconfig (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/Configurations/Base.xcconfig 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/Configurations/Base.xcconfig 2021-09-23 19:15:03 UTC (rev 282980)
@@ -180,6 +180,9 @@
WK_COCOA_TOUCH_appletvsimulator = cocoatouch;
WK_IS_COCOA_TOUCH = $(WK_NOT_$(WK_EMPTY_$(WK_COCOA_TOUCH)));
+WK_WEBKITADDITIONS_INSTALL_PATH = /usr/local/include/WebKitAdditions
+WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH = $(SDKROOT)/$(WK_WEBKITADDITIONS_INSTALL_PATH)
+
// Disable LTO for _javascript_Core, due to <rdar://problem/24543547>. Add back the following line and delete the one that says "LLVM_LTO = NO" when that issue is resolved.
// LLVM_LTO = $(WK_LLVM_LTO_$(WK_XCODE_SUPPORTS_LTO));
LLVM_LTO = NO;
Modified: branches/safari-612-branch/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2021-09-23 19:15:03 UTC (rev 282980)
@@ -11180,7 +11180,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --use-deployment-location\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/JSCLLIntSettingsExtractor\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\" \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS}\n";
+ shellScript = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/JSCLLIntSettingsExtractor\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\" \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS}\n";
};
14BD6892215191450050DAFF /* Generate Derived Sources */ = {
isa = PBXShellScriptBuildPhase;
@@ -11194,7 +11194,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --use-deployment-location\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_settings_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredSettings.h\" \"${ARCHS} C_LOOP\" ${OFFLINEASM_ARGS}\n";
+ shellScript = "set -e\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_settings_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${ARCHS}/LLIntDesiredSettings.h\" \"${ARCHS} C_LOOP\" ${OFFLINEASM_ARGS}\n";
};
1A02D9A81B34A882000D1522 /* Add Symlink in /System/Library/PrivateFrameworks */ = {
isa = PBXShellScriptBuildPhase;
@@ -11440,7 +11440,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n exit 0\nfi\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --use-deployment-location\"\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\"\n\n/usr/bin/env ruby _javascript_Core/offlineasm/asm.rb \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" _javascript_Core/llint/LowLevelInterpreter.asm \"${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor\" LLIntAssembly.h \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS} || exit 1\n";
+ shellScript = "if [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n exit 0\nfi\n\nOFFLINEASM_ARGS=\"\"\nif [[ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]]; then\n OFFLINEASM_ARGS=\"${OFFLINEASM_ARGS} --webkit-additions-path=${WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH}\"\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\"\n\n/usr/bin/env ruby _javascript_Core/offlineasm/asm.rb \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/_javascript_Core\" _javascript_Core/llint/LowLevelInterpreter.asm \"${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor\" LLIntAssembly.h \"${BUILD_VARIANTS}\" ${OFFLINEASM_ARGS} || exit 1\n";
};
65FB3F6509D11E9100F49DEB /* Generate Derived Sources */ = {
isa = PBXShellScriptBuildPhase;
Modified: branches/safari-612-branch/Source/_javascript_Core/offlineasm/asm.rb (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/offlineasm/asm.rb 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/offlineasm/asm.rb 2021-09-23 19:15:03 UTC (rev 282980)
@@ -335,13 +335,13 @@
$options = {}
OptionParser.new do |opts|
- opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>] [--use-deployment-location]"
+ opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>] [--webkit-additions-path=<path>]"
# This option is currently only used to specify the masm assembler
opts.on("--assembler=[ASM]", "Specify an assembler to use.") do |assembler|
$options[:assembler] = assembler
end
- opts.on("--use-deployment-location", "Flag to use deployment location.") do |flag|
- $options[:use_deployment_location] = flag
+ opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path|
+ $options[:webkit_additions_path] = path
end
end.parse!
Modified: branches/safari-612-branch/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb 2021-09-23 19:15:03 UTC (rev 282980)
@@ -48,9 +48,9 @@
$options = {}
OptionParser.new do |opts|
- opts.banner = "Usage: generate_offset_extractor.rb asmFile settingFile outputFileName backends variants [--use-deployment-location]"
- opts.on("--use-deployment-location", "Flag to use deployment location.") do |flag|
- $options[:use_deployment_location] = flag
+ opts.banner = "Usage: generate_offset_extractor.rb asmFile settingFile outputFileName backends variants [--webkit-additions-path=<path>]"
+ opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path|
+ $options[:webkit_additions_path] = path
end
end.parse!
Modified: branches/safari-612-branch/Source/_javascript_Core/offlineasm/generate_settings_extractor.rb (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/offlineasm/generate_settings_extractor.rb 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/offlineasm/generate_settings_extractor.rb 2021-09-23 19:15:03 UTC (rev 282980)
@@ -45,9 +45,9 @@
$options = {}
OptionParser.new do |opts|
- opts.banner = "Usage: generate_settings_extractor.rb asmFile settingFile [--use-deployment-location]"
- opts.on("--use-deployment-location", "Flag to use deployment location.") do |flag|
- $options[:use_deployment_location] = flag
+ opts.banner = "Usage: generate_settings_extractor.rb asmFile settingFile [--webkit-additions-path=<path>]"
+ opts.on("--webkit-additions-path=PATH", "WebKitAdditions path.") do |path|
+ $options[:webkit_additions_path] = path
end
end.parse!
Modified: branches/safari-612-branch/Source/_javascript_Core/offlineasm/parser.rb (282979 => 282980)
--- branches/safari-612-branch/Source/_javascript_Core/offlineasm/parser.rb 2021-09-23 19:14:59 UTC (rev 282979)
+++ branches/safari-612-branch/Source/_javascript_Core/offlineasm/parser.rb 2021-09-23 19:15:03 UTC (rev 282980)
@@ -84,7 +84,7 @@
directory = nil
@@includeDirs.each {
| includePath |
- fileName = includePath + (moduleName + ".asm")
+ fileName = File.join(includePath, moduleName + ".asm")
directory = includePath unless not File.file?(fileName)
}
if not directory
@@ -91,7 +91,7 @@
directory = defaultDir
end
- @fileName = directory + (moduleName + ".asm")
+ @fileName = File.join(directory, moduleName + ".asm")
end
def self.processIncludeOptions()
@@ -831,8 +831,8 @@
parseError unless isIdentifier(@tokens[@idx])
moduleName = @tokens[@idx].string
@idx += 1
- if @options[:use_deployment_location]
- additionsDirectoryName = "/usr/local/include/WebKitAdditions/"
+ if @options[:webkit_additions_path]
+ additionsDirectoryName = @options[:webkit_additions_path]
else
additionsDirectoryName = "#{@buildProductsDirectory}/usr/local/include/WebKitAdditions/"
end
@@ -867,8 +867,8 @@
parseError unless isIdentifier(@tokens[@idx])
moduleName = @tokens[@idx].string
@idx += 1
- if @options[:use_deployment_location]
- additionsDirectoryName = "/usr/local/include/WebKitAdditions/"
+ if @options[:webkit_additions_path]
+ additionsDirectoryName = @options[:webkit_additions_path]
else
additionsDirectoryName = "#{@buildProductsDirectory}/usr/local/include/WebKitAdditions/"
end