[msan] Fix handling of ParamTLS overflow.
authorEvgenii Stepanov <eugenis@google.com>
Fri, 24 Mar 2023 23:56:44 +0000 (16:56 -0700)
committerEvgenii Stepanov <eugenis@google.com>
Tue, 4 Apr 2023 20:52:09 +0000 (13:52 -0700)
commite0f7ef4b9ccf906f5382578a7ac0a0ba8d6d4f2b
tree725b6933bc40b361adf0580150a7b52515cf7914
parent87b5807d3802b932c06d83c4287014872aa2caab
[msan] Fix handling of ParamTLS overflow.

Ironically, MSan copies uninitialized data off the stack into
VAArgTLSCopy in the callee-side handling of va_start. Clamp the copy
size to the actual length of the buffer, and zero-initialize the
remainder.

Differential Revision: https://reviews.llvm.org/D146858
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64.ll
llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64le.ll
llvm/test/Instrumentation/MemorySanitizer/msan_debug_info.ll
llvm/test/Instrumentation/MemorySanitizer/msan_kernel_basic.ll