[compiler-rt] 15805c0 - [tests][msan] Use -fno-sanitize-memory-param-retval in tests

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 17:24:39 PDT 2022


Author: Vitaly Buka
Date: 2022-09-26T17:24:22-07:00
New Revision: 15805c030f31b8d112ee4a4706ff4f5725c794df

URL: https://github.com/llvm/llvm-project/commit/15805c030f31b8d112ee4a4706ff4f5725c794df
DIFF: https://github.com/llvm/llvm-project/commit/15805c030f31b8d112ee4a4706ff4f5725c794df.diff

LOG: [tests][msan] Use -fno-sanitize-memory-param-retval in tests

Supports either default of -f[no-]sanitize-memory-param-retval.

Reviewed By: aeubanks, MaskRay

Differential Revision: https://reviews.llvm.org/D134683

Added: 
    

Modified: 
    compiler-rt/test/msan/Linux/swapcontext_annotation_reset.cpp
    compiler-rt/test/msan/bsearch.cpp
    compiler-rt/test/msan/chained_origin.cpp
    compiler-rt/test/msan/chained_origin_empty_stack.cpp
    compiler-rt/test/msan/chained_origin_memcpy.cpp
    compiler-rt/test/msan/chained_origin_memmove.cpp
    compiler-rt/test/msan/cxa_atexit.cpp
    compiler-rt/test/msan/insertvalue_origin.cpp
    compiler-rt/test/msan/no_sanitize_memory_prop.cpp
    compiler-rt/test/msan/noundef_analysis.cpp
    compiler-rt/test/msan/param_tls_limit.cpp
    compiler-rt/test/msan/qsort.cpp
    compiler-rt/test/msan/signal_stress_test.cpp
    compiler-rt/test/msan/unpoison_param.cpp
    compiler-rt/test/msan/vector_cvt.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/msan/Linux/swapcontext_annotation_reset.cpp b/compiler-rt/test/msan/Linux/swapcontext_annotation_reset.cpp
index 342ef735daccf..682025269e38b 100644
--- a/compiler-rt/test/msan/Linux/swapcontext_annotation_reset.cpp
+++ b/compiler-rt/test/msan/Linux/swapcontext_annotation_reset.cpp
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -fno-sanitize=memory -c %s -o %t-main.o
-// RUN: %clangxx_msan %t-main.o %s -o %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fno-sanitize=memory -c %s -o %t-main.o
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval %t-main.o %s -o %t
 // RUN: %run %t
 
 #include <assert.h>

diff  --git a/compiler-rt/test/msan/bsearch.cpp b/compiler-rt/test/msan/bsearch.cpp
index bf2526ce4228b..965184a511642 100644
--- a/compiler-rt/test/msan/bsearch.cpp
+++ b/compiler-rt/test/msan/bsearch.cpp
@@ -1,12 +1,12 @@
 // __NO_INLINE__ is defined so bsearch needs interceptor.
-// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -DPOISON_DATA -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -DPOISON_KEY -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -DPOISON_DATA -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -DPOISON_KEY -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
 
 // __NO_INLINE__ is undefined so bsearch should be inlined and instrumented and still work as expected.
-// RUN: %clangxx_msan -O2 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -DPOISON_DATA -O2 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -DPOISON_KEY -O2 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O2 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -DPOISON_DATA -O2 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -DPOISON_KEY -O2 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
 
 #include <assert.h>
 #include <stdlib.h>

diff  --git a/compiler-rt/test/msan/chained_origin.cpp b/compiler-rt/test/msan/chained_origin.cpp
index 9fe73edb255cc..b98bc3dd00482 100644
--- a/compiler-rt/test/msan/chained_origin.cpp
+++ b/compiler-rt/test/msan/chained_origin.cpp
@@ -19,20 +19,11 @@
 
 volatile int x, y;
 
-__attribute__((noinline))
-void fn_g(int a) {
-  x = a;
-}
+__attribute__((noinline)) void fn_g(int &a) { x = a; }
 
-__attribute__((noinline))
-void fn_f(int a) {
-  fn_g(a);
-}
+__attribute__((noinline)) void fn_f(int &a) { fn_g(a); }
 
-__attribute__((noinline))
-void fn_h() {
-  y = x;
-}
+__attribute__((noinline)) void fn_h() { y = x; }
 
 int main(int argc, char *argv[]) {
 #ifdef HEAP
@@ -41,7 +32,7 @@ int main(int argc, char *argv[]) {
 #else
   int volatile z;
 #endif
-  fn_f(z);
+  fn_f((int &)z);
   fn_h();
   return y;
 }
@@ -50,13 +41,13 @@ int main(int argc, char *argv[]) {
 // CHECK: {{#0 .* in main.*chained_origin.cpp:}}[[@LINE-4]]
 
 // CHECK: Uninitialized value was stored to memory at
-// CHECK-FULL-STACK: {{#0 .* in fn_h.*chained_origin.cpp:}}[[@LINE-19]]
+// CHECK-FULL-STACK: {{#0 .* in fn_h.*chained_origin.cpp:}}[[@LINE-18]]
 // CHECK-FULL-STACK: {{#1 .* in main.*chained_origin.cpp:}}[[@LINE-9]]
 // CHECK-SHORT-STACK: {{#0 .* in fn_h.*chained_origin.cpp:}}[[@LINE-21]]
 
 // CHECK: Uninitialized value was stored to memory at
-// CHECK-FULL-STACK: {{#0 .* in fn_g.*chained_origin.cpp:}}[[@LINE-34]]
-// CHECK-FULL-STACK: {{#1 .* in fn_f.*chained_origin.cpp:}}[[@LINE-30]]
+// CHECK-FULL-STACK: {{#0 .* in fn_g.*chained_origin.cpp:}}[[@LINE-27]]
+// CHECK-FULL-STACK: {{#1 .* in fn_f.*chained_origin.cpp:}}[[@LINE-26]]
 // CHECK-FULL-STACK: {{#2 .* in main.*chained_origin.cpp:}}[[@LINE-16]]
 // CHECK-SHORT-STACK: {{#0 .* in fn_g.*chained_origin.cpp:}}[[@LINE-37]]
 

diff  --git a/compiler-rt/test/msan/chained_origin_empty_stack.cpp b/compiler-rt/test/msan/chained_origin_empty_stack.cpp
index 23d463358f96d..101016f2d347c 100644
--- a/compiler-rt/test/msan/chained_origin_empty_stack.cpp
+++ b/compiler-rt/test/msan/chained_origin_empty_stack.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
 // RUN:     MSAN_OPTIONS=store_context_size=1 not %run %t 2>&1 | FileCheck %s
 
 // Test that stack trace for the intermediate store is not empty.

diff  --git a/compiler-rt/test/msan/chained_origin_memcpy.cpp b/compiler-rt/test/msan/chained_origin_memcpy.cpp
index 4d4ae7fc07393..8961b4cd64da6 100644
--- a/compiler-rt/test/msan/chained_origin_memcpy.cpp
+++ b/compiler-rt/test/msan/chained_origin_memcpy.cpp
@@ -1,17 +1,16 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z1 --check-prefix=CHECK-%short-stack < %t.out
 
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z2 --check-prefix=CHECK-%short-stack < %t.out
 
-
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z1 --check-prefix=CHECK-%short-stack < %t.out
 
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z2 --check-prefix=CHECK-%short-stack < %t.out
 

diff  --git a/compiler-rt/test/msan/chained_origin_memmove.cpp b/compiler-rt/test/msan/chained_origin_memmove.cpp
index 1862ec81fef87..fcaf3735bd9d1 100644
--- a/compiler-rt/test/msan/chained_origin_memmove.cpp
+++ b/compiler-rt/test/msan/chained_origin_memmove.cpp
@@ -1,16 +1,16 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z1 --check-prefix=CHECK-%short-stack < %t.out
 
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z2 --check-prefix=CHECK-%short-stack < %t.out
 
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z1 --check-prefix=CHECK-%short-stack < %t.out
 
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
 // RUN:     not %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z2 --check-prefix=CHECK-%short-stack < %t.out
 

diff  --git a/compiler-rt/test/msan/cxa_atexit.cpp b/compiler-rt/test/msan/cxa_atexit.cpp
index 70384b9c93f88..1c63bb9d3e6a5 100644
--- a/compiler-rt/test/msan/cxa_atexit.cpp
+++ b/compiler-rt/test/msan/cxa_atexit.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 %s -o %t && %run %t %p
 
 // PR17377: C++ module destructors get stale argument shadow.
 

diff  --git a/compiler-rt/test/msan/insertvalue_origin.cpp b/compiler-rt/test/msan/insertvalue_origin.cpp
index 68e7d9a7b7f42..68b9ed158b25e 100644
--- a/compiler-rt/test/msan/insertvalue_origin.cpp
+++ b/compiler-rt/test/msan/insertvalue_origin.cpp
@@ -13,7 +13,7 @@ struct mypair {
  int y;
 };
 
-mypair my_make_pair(int64_t x, int y)  {
+mypair my_make_pair(int64_t &x, int y) {
  mypair p;
  p.x = x;
  p.y = y;

diff  --git a/compiler-rt/test/msan/no_sanitize_memory_prop.cpp b/compiler-rt/test/msan/no_sanitize_memory_prop.cpp
index cf21c94640435..47560b6619cd2 100644
--- a/compiler-rt/test/msan/no_sanitize_memory_prop.cpp
+++ b/compiler-rt/test/msan/no_sanitize_memory_prop.cpp
@@ -1,7 +1,7 @@
-// RUN: %clangxx_msan -O0 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -O1 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -O2 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -O3 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O1 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O2 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O3 %s -o %t && %run %t >%t.out 2>&1
 
 // Test that (no_sanitize_memory) functions DO NOT propagate shadow.
 

diff  --git a/compiler-rt/test/msan/noundef_analysis.cpp b/compiler-rt/test/msan/noundef_analysis.cpp
index 3de4d9955be05..47695ab63a612 100644
--- a/compiler-rt/test/msan/noundef_analysis.cpp
+++ b/compiler-rt/test/msan/noundef_analysis.cpp
@@ -1,8 +1,6 @@
-// RUN: %clangxx_msan %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan %s -fno-sanitize-memory-param-retval -o %t && %run %t >%t.out 2>&1
 // RUN: FileCheck %s --check-prefix=MISSED --allow-empty < %t.out
-// RUN: %clangxx_msan %s -mllvm -msan-eager-checks=1 -o %t && not %run %t >%t.out 2>&1
-// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan %s -disable-noundef-analysis -fsanitize-memory-param-retval -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan %s -mllvm -msan-eager-checks=1 -fno-sanitize-memory-param-retval -o %t && not %run %t >%t.out 2>&1
 // RUN: FileCheck %s < %t.out
 
 struct SimpleStruct {

diff  --git a/compiler-rt/test/msan/param_tls_limit.cpp b/compiler-rt/test/msan/param_tls_limit.cpp
index d6ff48c1bc584..0f5212737f171 100644
--- a/compiler-rt/test/msan/param_tls_limit.cpp
+++ b/compiler-rt/test/msan/param_tls_limit.cpp
@@ -1,9 +1,9 @@
 // ParamTLS has limited size. Everything that does not fit is considered fully
 // initialized.
 
-// RUN: %clangxx_msan -O0 %s -o %t && %run %t
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -O0 %s -o %t && %run %t
 //
 // AArch64 fails with:
 // void f801(S<801>): Assertion `__msan_test_shadow(&s, sizeof(s)) == -1' failed

diff  --git a/compiler-rt/test/msan/qsort.cpp b/compiler-rt/test/msan/qsort.cpp
index f052ed17ceef3..af287ed64357e 100644
--- a/compiler-rt/test/msan/qsort.cpp
+++ b/compiler-rt/test/msan/qsort.cpp
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -DPOISON -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -DPOISON -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
 
 #include <assert.h>
 #include <errno.h>

diff  --git a/compiler-rt/test/msan/signal_stress_test.cpp b/compiler-rt/test/msan/signal_stress_test.cpp
index dfbc580faf2cc..fd434add261c9 100644
--- a/compiler-rt/test/msan/signal_stress_test.cpp
+++ b/compiler-rt/test/msan/signal_stress_test.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -std=c++11 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -std=c++11 -O0 %s -o %t && %run %t
 //
 // Test that va_arg shadow from a signal handler does not leak outside.
 

diff  --git a/compiler-rt/test/msan/unpoison_param.cpp b/compiler-rt/test/msan/unpoison_param.cpp
index f59d2cbe23138..7687cd8268396 100644
--- a/compiler-rt/test/msan/unpoison_param.cpp
+++ b/compiler-rt/test/msan/unpoison_param.cpp
@@ -3,7 +3,7 @@
 // compile main() without MSan.
 
 // RUN: %clangxx_msan -fno-sanitize=memory -c %s -o %t-main.o
-// RUN: %clangxx_msan %t-main.o %s -o %t
+// RUN: %clangxx_msan -fno-sanitize-memory-param-retval %t-main.o %s -o %t
 // RUN: %run %t
 
 #include <assert.h>

diff  --git a/compiler-rt/test/msan/vector_cvt.cpp b/compiler-rt/test/msan/vector_cvt.cpp
index aa5327e3c19ca..f318f666d397b 100644
--- a/compiler-rt/test/msan/vector_cvt.cpp
+++ b/compiler-rt/test/msan/vector_cvt.cpp
@@ -4,7 +4,7 @@
 
 #include <emmintrin.h>
 
-int to_int(double v) {
+int to_int(double &v) {
   __m128d t = _mm_set_sd(v);
   int x = _mm_cvtsd_si32(t);
   return x;


        


More information about the llvm-commits mailing list