Skip to content

Commit 520c290

Browse files
Dominik Inführmibrunin
authored andcommitted
[Backport] CVE-2024-0518: Type Confusion in V8
Manual backport of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/5125960: [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 Change-Id: I8855ed7ecc50c4a47d2c89043d62ac053858bc75 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5125960 Reviewed-by: Leszek Swirski <[email protected]> Commit-Queue: Dominik Inführ <[email protected]> Cr-Commit-Position: refs/heads/main@{#91568} Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/532071 Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent b3bd93f commit 520c290

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chromium/v8/src/codegen/compiler.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,11 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
543543
shared_info->set_is_asm_wasm_broken(true);
544544
}
545545

546-
shared_info->set_bytecode_array(*compilation_info->bytecode_array());
547-
548546
Handle<FeedbackMetadata> feedback_metadata = FeedbackMetadata::New(
549547
isolate, compilation_info->feedback_vector_spec());
550548
shared_info->set_feedback_metadata(*feedback_metadata);
549+
550+
shared_info->set_bytecode_array(*compilation_info->bytecode_array());
551551
} else {
552552
DCHECK(compilation_info->has_asm_wasm_data());
553553
// We should only have asm/wasm data when finalizing on the main thread.

0 commit comments

Comments
 (0)