[compiler-rt] r193529 - [msan] Fix a typo and enable poison_in_free flag.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Mon Oct 28 11:53:37 PDT 2013
Author: eugenis
Date: Mon Oct 28 13:53:37 2013
New Revision: 193529
URL: http://llvm.org/viewvc/llvm-project?rev=193529&view=rev
Log:
[msan] Fix a typo and enable poison_in_free flag.
Added:
compiler-rt/trunk/lib/msan/lit_tests/poison_in_free.cc
Modified:
compiler-rt/trunk/lib/msan/msan.cc
Added: compiler-rt/trunk/lib/msan/lit_tests/poison_in_free.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/poison_in_free.cc?rev=193529&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/lit_tests/poison_in_free.cc (added)
+++ compiler-rt/trunk/lib/msan/lit_tests/poison_in_free.cc Mon Oct 28 13:53:37 2013
@@ -0,0 +1,16 @@
+// RUN: %clangxx_msan -O0 %s -o %t && not %t >%t.out 2>&1
+// FileCheck %s <%t.out
+// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=poison_in_free=0 %t >%t.out 2>&1
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+ char *volatile x = (char*)malloc(50 * sizeof(char));
+ memset(x, 0, 50);
+ free(x);
+ return x[25];
+ // CHECK: MemorySanitizer: use-of-uninitialized-value
+ // CHECK: #0 {{.*}} in main{{.*}}poison_in_free.cc:[[@LINE-2]]
+}
Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=193529&r1=193528&r2=193529&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Mon Oct 28 13:53:37 2013
@@ -122,7 +122,7 @@ static void ParseFlagsFromString(Flags *
ParseFlag(str, &f->poison_heap_with_zeroes, "poison_heap_with_zeroes");
ParseFlag(str, &f->poison_stack_with_zeroes, "poison_stack_with_zeroes");
ParseFlag(str, &f->poison_in_malloc, "poison_in_malloc");
- ParseFlag(str, &f->poison_in_malloc, "poison_in_free");
+ ParseFlag(str, &f->poison_in_free, "poison_in_free");
ParseFlag(str, &f->exit_code, "exit_code");
if (f->exit_code < 0 || f->exit_code > 127) {
Printf("Exit code not in [0, 128) range: %d\n", f->exit_code);
More information about the llvm-commits
mailing list