Commit fbb8efd2 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

[strings] Teach MSAN about uninitialized SeqString padding bytes

Bug: v8:12939
Change-Id: I853a718dec39485ae1ab1263e2be8f04567447f1
No-Tree-Checks: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3722455Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Owners-Override: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81339}
parent 06b4d0a2
......@@ -1178,8 +1178,15 @@ void Serializer::ObjectSerializer::OutputRawData(Address up_to) {
}
#ifdef MEMORY_SANITIZER
// Check that we do not serialize uninitialized memory.
int msan_bytes_to_output = bytes_to_output;
if (object_->IsSeqString()) {
// SeqStrings may have uninitialized padding bytes. These padding
// bytes are never read and serialized as 0s.
msan_bytes_to_output -=
SeqString::cast(*object_).GetDataAndPaddingSizes().padding_size;
}
__msan_check_mem_is_initialized(
reinterpret_cast<void*>(object_start + base), bytes_to_output);
reinterpret_cast<void*>(object_start + base), msan_bytes_to_output);
#endif // MEMORY_SANITIZER
PtrComprCageBase cage_base(isolate_);
if (object_->IsBytecodeArray(cage_base)) {
......
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