aeubanks created this revision. aeubanks added a reviewer: vitalybuka. Herald added a project: All. aeubanks requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
This eagerly reports use of undef values when passed to noundef parameters or returned from noundef functions. This also decreases binary sizes under msan. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D134669 Files: clang/include/clang/Driver/Options.td clang/test/CodeGen/kmsan-param-retval.c clang/test/CodeGen/msan-param-retval.c Index: clang/test/CodeGen/msan-param-retval.c =================================================================== --- clang/test/CodeGen/msan-param-retval.c +++ clang/test/CodeGen/msan-param-retval.c @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \ // RUN: FileCheck %s --check-prefix=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -fsanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER void bar(int x) { Index: clang/test/CodeGen/kmsan-param-retval.c =================================================================== --- clang/test/CodeGen/kmsan-param-retval.c +++ clang/test/CodeGen/kmsan-param-retval.c @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -o - %s | \ // RUN: FileCheck %s --check-prefix=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -fno-sanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -mllvm -msan-eager-checks -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -fsanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER void foo(); Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1767,7 +1767,7 @@ defm sanitize_memory_param_retval : BoolFOption<"sanitize-memory-param-retval", CodeGenOpts<"SanitizeMemoryParamRetval">, - DefaultFalse, + DefaultTrue, PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">, BothFlags<[], " detection of uninitialized parameters and return values">>; //// Note: This flag was introduced when it was necessary to distinguish between
Index: clang/test/CodeGen/msan-param-retval.c =================================================================== --- clang/test/CodeGen/msan-param-retval.c +++ clang/test/CodeGen/msan-param-retval.c @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \ // RUN: FileCheck %s --check-prefix=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -fsanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -fsanitize=memory -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER void bar(int x) { Index: clang/test/CodeGen/kmsan-param-retval.c =================================================================== --- clang/test/CodeGen/kmsan-param-retval.c +++ clang/test/CodeGen/kmsan-param-retval.c @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -o - %s | \ // RUN: FileCheck %s --check-prefix=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -fno-sanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -mllvm -msan-eager-checks -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN -// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -fsanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -emit-llvm -O2 -fsanitize=kernel-memory -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER void foo(); Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1767,7 +1767,7 @@ defm sanitize_memory_param_retval : BoolFOption<"sanitize-memory-param-retval", CodeGenOpts<"SanitizeMemoryParamRetval">, - DefaultFalse, + DefaultTrue, PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">, BothFlags<[], " detection of uninitialized parameters and return values">>; //// Note: This flag was introduced when it was necessary to distinguish between
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits