[msan] Fix msan false-positive in the simulator

Bug: 344654370
Change-Id: I0d4cbc7c873ede056d0835b04a008af45c27ddab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5622010
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94372}
This commit is contained in:
Andreas Haas authored and V8 LUCI CQ committed 2024-06-11 14:02:36 +00:00
1 parent 8b4dc9f062
commit 77723b5bdb
1 file changed
+38
+38
View File
@@ -678,6 +678,44 @@ void Simulator::DoRuntimeCall(Instruction* instr) {
const int64_t arg19 = stack_pointer[11];
static_assert(kMaxCParameters == 20);
#ifdef V8_USE_MEMORY_SANITIZER
// `UnsafeGenericFunctionCall()` dispatches calls to functions with
// varying signatures and relies on the fact that the mismatched prototype
// used by the caller and the prototype used by the callee (defined using
// the `RUNTIME_FUNCTION*()` macros happen to line up so that things more
// or less work out [1].
//
// Unfortunately, this confuses MSan's uninit tracking with eager checks
// enabled; it's unclear if these are all false positives or if there are
// legitimate reports. For now, unconditionally unpoison args to
// unblock finding and fixing more violations with MSan eager checks.
//
// TODO(crbug.com/v8/14712): Fix the MSan violations and migrate to
// something like crrev.com/c/5422076 instead.
//
// [1] Yes, this is undefined behaviour. 🙈🙉🙊
MSAN_MEMORY_IS_INITIALIZED(&arg0, sizeof(arg0));
MSAN_MEMORY_IS_INITIALIZED(&arg1, sizeof(arg1));
MSAN_MEMORY_IS_INITIALIZED(&arg2, sizeof(arg2));
MSAN_MEMORY_IS_INITIALIZED(&arg3, sizeof(arg3));
MSAN_MEMORY_IS_INITIALIZED(&arg4, sizeof(arg4));
MSAN_MEMORY_IS_INITIALIZED(&arg5, sizeof(arg5));
MSAN_MEMORY_IS_INITIALIZED(&arg6, sizeof(arg6));
MSAN_MEMORY_IS_INITIALIZED(&arg7, sizeof(arg7));
MSAN_MEMORY_IS_INITIALIZED(&arg8, sizeof(arg8));
MSAN_MEMORY_IS_INITIALIZED(&arg9, sizeof(arg9));
MSAN_MEMORY_IS_INITIALIZED(&arg10, sizeof(arg10));
MSAN_MEMORY_IS_INITIALIZED(&arg11, sizeof(arg11));
MSAN_MEMORY_IS_INITIALIZED(&arg12, sizeof(arg12));
MSAN_MEMORY_IS_INITIALIZED(&arg13, sizeof(arg13));
MSAN_MEMORY_IS_INITIALIZED(&arg14, sizeof(arg14));
MSAN_MEMORY_IS_INITIALIZED(&arg15, sizeof(arg15));
MSAN_MEMORY_IS_INITIALIZED(&arg16, sizeof(arg16));
MSAN_MEMORY_IS_INITIALIZED(&arg17, sizeof(arg17));
MSAN_MEMORY_IS_INITIALIZED(&arg18, sizeof(arg18));
MSAN_MEMORY_IS_INITIALIZED(&arg19, sizeof(arg19));
#endif // V8_USE_MEMORY_SANITIZER
switch (redirection->type()) {
default:
TraceSim("Type: Unknown.\n");