Skip to content

Commit f2dc43a

Browse files
XadillaXdanielleadams
authored andcommitted
deps: cherry-pick 4ab70f6 from V8 upstream
[Compiler] Remove untrusted code mitigations. These are no longer enabled, so remove the code mitigation logic from the codebase. BUG=chromium:1003890 Change-Id: I536bb1732e8463281c21da446bbba8f47ede8ebe Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3045704 Commit-Queue: Ross McIlroy <[email protected]> Reviewed-by: Jakob Gruber <[email protected]> Reviewed-by: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/master@{#76256} Refs: v8/v8@4ab70f6 Fixes: #43296 PR-URL: #43328 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 5ebed62 commit f2dc43a

File tree

148 files changed

+769
-3290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+769
-3290
lines changed

deps/v8/BUILD.bazel

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ config_setting(
150150
# v8_can_use_fpu_instructions
151151
# v8_use_mips_abi_hardfloat
152152
# v8_enable_gdbjit
153-
# v8_untrusted_code_mitigations
154153
# v8_enable_minor_mc
155154
# v8_check_header_includes
156155
# v8_enable_shared_ro_heap
@@ -305,9 +304,6 @@ v8_config(
305304
"V8_HAVE_TARGET_OS",
306305
"V8_TARGET_OS_MACOSX",
307306
],
308-
}) + select({
309-
":is_android_x86": [ "DISABLE_UNTRUSTED_CODE_MITIGATIONS" ],
310-
"//conditions:default": [],
311307
}) + select({
312308
":is_v8_enable_pointer_compression": [
313309
"V8_COMPRESS_POINTERS",

deps/v8/BUILD.gn

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,6 @@ declare_args() {
228228
(is_linux || is_chromeos || is_mac)) ||
229229
(v8_current_cpu == "ppc64" && (is_linux || is_chromeos))
230230

231-
# Enable mitigations for executing untrusted code.
232-
# Disabled by default on ia32 due to conflicting requirements with embedded
233-
# builtins.
234-
v8_untrusted_code_mitigations = false
235-
236231
# Enable minor mark compact.
237232
v8_enable_minor_mc = true
238233

@@ -461,9 +456,6 @@ if (build_with_chromium && v8_current_cpu == "arm64" &&
461456
assert(!v8_disable_write_barriers || v8_enable_single_generation,
462457
"Disabling write barriers works only with single generation")
463458

464-
assert(v8_current_cpu != "x86" || !v8_untrusted_code_mitigations,
465-
"Untrusted code mitigations are unsupported on ia32")
466-
467459
assert(v8_current_cpu == "arm64" || !v8_control_flow_integrity,
468460
"Control-flow integrity is only supported on arm64")
469461

@@ -480,9 +472,6 @@ assert(!v8_enable_map_packing || !v8_enable_pointer_compression,
480472
assert(!v8_enable_map_packing || v8_current_cpu == "x64",
481473
"Map packing is only supported on x64")
482474

483-
assert(!v8_use_multi_snapshots || !v8_control_flow_integrity,
484-
"Control-flow integrity does not support multisnapshots")
485-
486475
assert(!v8_enable_heap_sandbox || v8_enable_pointer_compression,
487476
"V8 Heap Sandbox requires pointer compression")
488477

@@ -872,9 +861,6 @@ config("features") {
872861
if (v8_enable_lazy_source_positions) {
873862
defines += [ "V8_ENABLE_LAZY_SOURCE_POSITIONS" ]
874863
}
875-
if (v8_use_multi_snapshots) {
876-
defines += [ "V8_MULTI_SNAPSHOTS" ]
877-
}
878864
if (v8_use_siphash) {
879865
defines += [ "V8_USE_SIPHASH" ]
880866
}
@@ -1170,10 +1156,6 @@ config("toolchain") {
11701156
defines += [ "V8_RUNTIME_CALL_STATS" ]
11711157
}
11721158

1173-
if (!v8_untrusted_code_mitigations) {
1174-
defines += [ "DISABLE_UNTRUSTED_CODE_MITIGATIONS" ]
1175-
}
1176-
11771159
if (v8_no_inline) {
11781160
if (is_win) {
11791161
cflags += [ "/Ob0" ]
@@ -1309,8 +1291,6 @@ template("asm_to_inline_asm") {
13091291
if (is_android && enable_java_templates) {
13101292
android_assets("v8_external_startup_data_assets") {
13111293
if (v8_use_external_startup_data) {
1312-
# We don't support side-by-side snapshots on Android within Chromium.
1313-
assert(!v8_use_multi_snapshots)
13141294
deps = [ "//v8" ]
13151295
renaming_sources = [ "$root_out_dir/snapshot_blob.bin" ]
13161296
if (current_cpu == "arm" || current_cpu == "x86" ||
@@ -1987,17 +1967,6 @@ if (emit_builtins_as_inline_asm) {
19871967
args = []
19881968
}
19891969
}
1990-
if (v8_use_multi_snapshots) {
1991-
run_mksnapshot("trusted") {
1992-
args = [ "--no-untrusted-code-mitigations" ]
1993-
embedded_variant = "Trusted"
1994-
}
1995-
if (emit_builtins_as_inline_asm) {
1996-
asm_to_inline_asm("trusted") {
1997-
args = []
1998-
}
1999-
}
2000-
}
20011970

20021971
action("v8_dump_build_config") {
20031972
script = "tools/testrunner/utils/dump_build_config.py"
@@ -2086,16 +2055,6 @@ v8_source_set("v8_snapshot") {
20862055
deps += [ ":v8_base" ]
20872056

20882057
sources += [ "src/snapshot/snapshot-external.cc" ]
2089-
2090-
if (v8_use_multi_snapshots) {
2091-
public_deps += [ ":run_mksnapshot_trusted" ]
2092-
if (emit_builtins_as_inline_asm) {
2093-
deps += [ ":asm_to_inline_asm_trusted" ]
2094-
sources += [ "$target_gen_dir/embedded_trusted.cc" ]
2095-
} else {
2096-
sources += [ "$target_gen_dir/embedded_trusted.S" ]
2097-
}
2098-
}
20992058
} else {
21002059
# Also top-level visibility targets can depend on this.
21012060
visibility += [ "//:gn_visibility" ]

deps/v8/gni/v8.gni

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ declare_args() {
3535
# as an argument to profiler's method `takeHeapSnapshot`.
3636
v8_enable_raw_heap_snapshots = false
3737

38-
# Enable several snapshots side-by-side (e.g. default and for trusted code).
38+
# Deprecated flag that no longer does anything.
39+
# TODO(rmcilroy): Remove this gn arg once it's no longer used by the bots.
3940
v8_use_multi_snapshots = false
4041

4142
# Use external files for startup data blobs:
@@ -99,13 +100,6 @@ if (v8_use_external_startup_data == "") {
99100
v8_use_external_startup_data = !is_ios
100101
}
101102

102-
if (v8_use_multi_snapshots) {
103-
# Silently disable multi snapshots if they're incompatible with the current
104-
# build configuration. This allows us to set v8_use_multi_snapshots=true on
105-
# all bots, and e.g. no-snapshot bots will automatically do the right thing.
106-
v8_use_multi_snapshots = v8_use_external_startup_data && !build_with_chromium
107-
}
108-
109103
if (v8_enable_backtrace == "") {
110104
v8_enable_backtrace = is_debug && !v8_optimized_debug
111105
}

deps/v8/src/builtins/arm/builtins-arm.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,12 +2777,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
27772777
__ cmp(cp, Operand(0));
27782778
__ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne);
27792779

2780-
// Reset the masking register. This is done independent of the underlying
2781-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
2782-
// with both configurations. It is safe to always do this, because the
2783-
// underlying register is caller-saved and can be arbitrarily clobbered.
2784-
__ ResetSpeculationPoisonRegister();
2785-
27862780
// Clear c_entry_fp, like we do in `LeaveExitFrame`.
27872781
{
27882782
UseScratchRegisterScope temps(masm);

deps/v8/src/builtins/arm64/builtins-arm64.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,12 +3250,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
32503250
__ Str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
32513251
__ Bind(&not_js_frame);
32523252

3253-
// Reset the masking register. This is done independent of the underlying
3254-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
3255-
// with both configurations. It is safe to always do this, because the
3256-
// underlying register is caller-saved and can be arbitrarily clobbered.
3257-
__ ResetSpeculationPoisonRegister();
3258-
32593253
{
32603254
// Clear c_entry_fp, like we do in `LeaveExitFrame`.
32613255
UseScratchRegisterScope temps(masm);

deps/v8/src/builtins/mips/builtins-mips.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,12 +2723,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
27232723
__ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
27242724
__ bind(&zero);
27252725

2726-
// Reset the masking register. This is done independent of the underlying
2727-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
2728-
// with both configurations. It is safe to always do this, because the
2729-
// underlying register is caller-saved and can be arbitrarily clobbered.
2730-
__ ResetSpeculationPoisonRegister();
2731-
27322726
// Clear c_entry_fp, like we do in `LeaveExitFrame`.
27332727
{
27342728
UseScratchRegisterScope temps(masm);

deps/v8/src/builtins/mips64/builtins-mips64.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,12 +2814,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
28142814
__ Sd(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
28152815
__ bind(&zero);
28162816

2817-
// Reset the masking register. This is done independent of the underlying
2818-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
2819-
// with both configurations. It is safe to always do this, because the
2820-
// underlying register is caller-saved and can be arbitrarily clobbered.
2821-
__ ResetSpeculationPoisonRegister();
2822-
28232817
// Clear c_entry_fp, like we do in `LeaveExitFrame`.
28242818
{
28252819
UseScratchRegisterScope temps(masm);

deps/v8/src/builtins/ppc/builtins-ppc.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,12 +2646,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
26462646
__ StoreU64(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
26472647
__ bind(&skip);
26482648

2649-
// Reset the masking register. This is done independent of the underlying
2650-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
2651-
// with both configurations. It is safe to always do this, because the
2652-
// underlying register is caller-saved and can be arbitrarily clobbered.
2653-
__ ResetSpeculationPoisonRegister();
2654-
26552649
// Clear c_entry_fp, like we do in `LeaveExitFrame`.
26562650
{
26572651
UseScratchRegisterScope temps(masm);

deps/v8/src/builtins/riscv64/builtins-riscv64.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,12 +2903,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
29032903
__ Sd(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
29042904
__ bind(&zero);
29052905

2906-
// Reset the masking register. This is done independent of the underlying
2907-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
2908-
// with both configurations. It is safe to always do this, because the
2909-
// underlying register is caller-saved and can be arbitrarily clobbered.
2910-
__ ResetSpeculationPoisonRegister();
2911-
29122906
// Compute the handler entry address and jump to it.
29132907
UseScratchRegisterScope temp(masm);
29142908
Register scratch = temp.Acquire();

deps/v8/src/builtins/s390/builtins-s390.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,12 +2679,6 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
26792679
__ StoreU64(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
26802680
__ bind(&skip);
26812681

2682-
// Reset the masking register. This is done independent of the underlying
2683-
// feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work
2684-
// with both configurations. It is safe to always do this, because the
2685-
// underlying register is caller-saved and can be arbitrarily clobbered.
2686-
__ ResetSpeculationPoisonRegister();
2687-
26882682
// Clear c_entry_fp, like we do in `LeaveExitFrame`.
26892683
{
26902684
UseScratchRegisterScope temps(masm);

0 commit comments

Comments
 (0)