Only enable sandbox on supported arches

Bug: v8:13281
Change-Id: Ie61eb42ad6be565c8be76c9b4aa63282c7856f25
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905190
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Stephen Röttger <sroettger@google.com>
Cr-Commit-Position: refs/heads/main@{#83340}
This commit is contained in:
Stephen Roettger 2022-09-20 14:09:09 +02:00 committed by V8 LUCI CQ
parent 2e8d8f8f86
commit 36d0b30adf

View File

@ -46,6 +46,7 @@ ARCHES = [
] ]
# Arches that get built/run when you don't specify any. # Arches that get built/run when you don't specify any.
DEFAULT_ARCHES = ["ia32", "x64", "arm", "arm64"] DEFAULT_ARCHES = ["ia32", "x64", "arm", "arm64"]
SANDBOX_SUPPORTED_ARCHES = ["x64", "arm64"]
# Modes that this script understands. # Modes that this script understands.
MODES = { MODES = {
"release": "release", "release": "release",
@ -169,7 +170,6 @@ v8_enable_disassembler = true
v8_enable_object_print = true v8_enable_object_print = true
v8_enable_verify_heap = true v8_enable_verify_heap = true
dcheck_always_on = false dcheck_always_on = false
v8_enable_sandbox = true
""".replace("{GOMA}", USE_GOMA) """.replace("{GOMA}", USE_GOMA)
DEBUG_ARGS_TEMPLATE = """\ DEBUG_ARGS_TEMPLATE = """\
@ -182,7 +182,6 @@ v8_enable_backtrace = true
v8_enable_fast_mksnapshot = true v8_enable_fast_mksnapshot = true
v8_enable_slow_dchecks = true v8_enable_slow_dchecks = true
v8_optimized_debug = false v8_optimized_debug = false
v8_enable_sandbox = true
""".replace("{GOMA}", USE_GOMA) """.replace("{GOMA}", USE_GOMA)
OPTDEBUG_ARGS_TEMPLATE = """\ OPTDEBUG_ARGS_TEMPLATE = """\
@ -195,7 +194,6 @@ v8_enable_backtrace = true
v8_enable_fast_mksnapshot = true v8_enable_fast_mksnapshot = true
v8_enable_verify_heap = true v8_enable_verify_heap = true
v8_optimized_debug = true v8_optimized_debug = true
v8_enable_sandbox = true
""".replace("{GOMA}", USE_GOMA) """.replace("{GOMA}", USE_GOMA)
ARGS_TEMPLATES = { ARGS_TEMPLATES = {
@ -348,12 +346,18 @@ class Config(object):
return ["clang_base_path = \"/usr\"", "clang_use_chrome_plugins = false"] return ["clang_base_path = \"/usr\"", "clang_use_chrome_plugins = false"]
return [] return []
def GetSandboxFlag(self):
if self.arch in SANDBOX_SUPPORTED_ARCHES:
return ["v8_enable_sandbox = true"]
return []
def GetGnArgs(self): def GetGnArgs(self):
# Use only substring before first '-' as the actual mode # Use only substring before first '-' as the actual mode
mode = re.match("([^-]+)", self.mode).group(1) mode = re.match("([^-]+)", self.mode).group(1)
template = ARGS_TEMPLATES[mode] template = ARGS_TEMPLATES[mode]
arch_specific = (self.GetTargetCpu() + self.GetV8TargetCpu() + arch_specific = (
self.GetTargetOS() + self.GetSpecialCompiler()) self.GetTargetCpu() + self.GetV8TargetCpu() + self.GetTargetOS() +
self.GetSpecialCompiler() + self.GetSandboxFlag())
return template % "\n".join(arch_specific) return template % "\n".join(arch_specific)
def Build(self): def Build(self):