Commit 05b9270b authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[ext-code-space] Make snapshot deterministic again

The contents of CodeDataContainer::code_cage_base field was
accidentally written during serialization while zeros should
have been written instead.

Bug: v8:11880
Change-Id: Ib1d66d2fe8cceace19f4feb57950838bfbc89efa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3422642
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78841}
parent 7fa01406
......@@ -1133,13 +1133,16 @@ void Serializer::ObjectSerializer::OutputRawData(Address up_to) {
sizeof(field_value), field_value);
} else if (V8_EXTERNAL_CODE_SPACE_BOOL &&
object_->IsCodeDataContainer(cage_base)) {
// The CodeEntryPoint field is just a cached value which will be
// recomputed after deserialization, so write zeros to keep the snapshot
// deterministic.
static byte field_value[kExternalPointerSize] = {0};
OutputRawWithCustomField(sink_, object_start, base, bytes_to_output,
CodeDataContainer::kCodeEntryPointOffset,
sizeof(field_value), field_value);
// code_cage_base and code_entry_point fields contain raw values that
// will be recomputed after deserialization, so write zeros to keep the
// snapshot deterministic.
CHECK_EQ(CodeDataContainer::kCodeCageBaseUpper32BitsOffset + kTaggedSize,
CodeDataContainer::kCodeEntryPointOffset);
static byte field_value[kTaggedSize + kExternalPointerSize] = {0};
OutputRawWithCustomField(
sink_, object_start, base, bytes_to_output,
CodeDataContainer::kCodeCageBaseUpper32BitsOffset,
sizeof(field_value), field_value);
} else {
sink_->PutRaw(reinterpret_cast<byte*>(object_start + base),
bytes_to_output, "Bytes");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment