Skip to content

Commit 1620885

Browse files
Dominik Inführmibrunin
authored andcommitted
[Backport] CVE-2024-0518: Type Confusion in V8
Cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/5180369: Merged: [codegen] Install BytecodeArray last in SharedFunctionInfo Maglev assumes that when a SharedFunctionInfo has a BytecodeArray, then it should also have FeedbackMetadata. However, this may not hold with concurrent compilation when the SharedFunctionInfo is re-compiled after being flushed. Here the BytecodeArray was installed on the SFI before the FeedbackMetadata and a concurrent thread could observe the BytecodeArray but not the FeedbackMetadata. Drive-by: Reset the age field before setting the BytecodeArray as well. This ensures that the concurrent marker will not observe the old age for the new BytecodeArray. Bug: chromium:1507412 (cherry picked from commit 46cb67e3b296e50d7fda5a58233d18b9f3dab0d5) Change-Id: Ide73ac1c6b0a68a1fcf847c8351ec65016e55762 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5180369 Reviewed-by: Leszek Swirski <[email protected]> Commit-Queue: Dominik Inführ <[email protected]> Cr-Commit-Position: refs/branch-heads/12.0@{#28} Cr-Branched-From: ed7b4caf1fb8184ad9e24346c84424055d4d430a-refs/heads/12.0.267@{#1} Cr-Branched-From: 210e75b19db4352c9b78dce0bae11c2dc3077df4-refs/heads/main@{#90651} Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/531979 Reviewed-by: Michal Klocek <[email protected]>
1 parent 42ad0cc commit 1620885

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chromium/v8/src/codegen/compiler.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,12 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
724724
}
725725
#endif // V8_ENABLE_WEBASSEMBLY
726726

727-
shared_info->set_bytecode_array(*compilation_info->bytecode_array());
728-
shared_info->set_age(0);
729-
730727
Handle<FeedbackMetadata> feedback_metadata = FeedbackMetadata::New(
731728
isolate, compilation_info->feedback_vector_spec());
732729
shared_info->set_feedback_metadata(*feedback_metadata, kReleaseStore);
730+
731+
shared_info->set_age(0);
732+
shared_info->set_bytecode_array(*compilation_info->bytecode_array());
733733
} else {
734734
#if V8_ENABLE_WEBASSEMBLY
735735
DCHECK(compilation_info->has_asm_wasm_data());

0 commit comments

Comments
 (0)