OSDN Git Service

[MSan] Make sure variadic function arguments do not overflow __msan_va_arg_tls
authorAlexander Potapenko <glider@google.com>
Thu, 6 Sep 2018 08:21:54 +0000 (08:21 +0000)
committerAlexander Potapenko <glider@google.com>
Thu, 6 Sep 2018 08:21:54 +0000 (08:21 +0000)
commitac23fcdc321d9bf08d00697849ebbbdf850ecef6
tree86249be32c829c5b30b6cdcc68de225e00099803
parentafed9811bff1fe8c5f50773fd2d47fb6e70e6559
[MSan] Make sure variadic function arguments do not overflow __msan_va_arg_tls

Turns out that calling a variadic function with too many (e.g. >100 i64's)
arguments overflows __msan_va_arg_tls, which leads to smashing other TLS
data with function argument shadow values.

getShadow() already checks for kParamTLSSize and returns clean shadow if
the argument does not fit, so just skip storing argument shadow for such
arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341525 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/MemorySanitizer.cpp
test/Instrumentation/MemorySanitizer/AArch64/vararg.ll
test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64.ll
test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64le.ll
test/Instrumentation/MemorySanitizer/X86/vararg-too-large.ll [new file with mode: 0644]