]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: enable taint state machine by default [PR103533]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 14 Nov 2023 20:51:52 +0000 (15:51 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 14 Nov 2023 20:51:52 +0000 (15:51 -0500)
gcc/analyzer/ChangeLog:
PR analyzer/103533
* sm-taint.cc: Remove "experimental" from comment.
* sm.cc (make_checkers): Always add taint state machine.

gcc/ChangeLog:
PR analyzer/103533
* doc/invoke.texi (Static Analyzer Options): Add the six
-Wanalyzer-tainted-* warnings.  Update documentation of each
warning to reflect removed requirement to use
-fanalyzer-checker=taint.  Remove discussion of
-fanalyzer-checker=taint.

gcc/testsuite/ChangeLog:
PR analyzer/103533
* c-c++-common/analyzer/attr-tainted_args-1.c: Remove use of
-fanalyzer-checker=taint.
* c-c++-common/analyzer/fread-1.c: Likewise.
* c-c++-common/analyzer/pr104029.c: Likewise.
* gcc.dg/analyzer/pr93032-mztools-signed-char.c: Add params to
work around state explosion.
* gcc.dg/analyzer/pr93032-mztools-unsigned-char.c: Likewise.
* gcc.dg/analyzer/pr93382.c: Remove use of
-fanalyzer-checker=taint.
* gcc.dg/analyzer/switch-enum-taint-1.c: Likewise.
* gcc.dg/analyzer/taint-CVE-2011-2210-1.c: Likewise.
* gcc.dg/analyzer/taint-CVE-2020-13143-1.c: Likewise.
* gcc.dg/analyzer/taint-CVE-2020-13143-2.c: Likewise.
* gcc.dg/analyzer/taint-CVE-2020-13143.h: Likewise.
* gcc.dg/analyzer/taint-alloc-1.c: Likewise.
* gcc.dg/analyzer/taint-alloc-2.c: Likewise.
* gcc.dg/analyzer/taint-alloc-3.c: Likewise.
* gcc.dg/analyzer/taint-alloc-4.c: Likewise.
* gcc.dg/analyzer/taint-alloc-5.c: Likewise.
* gcc.dg/analyzer/taint-assert-BUG_ON.c: Likewise.
* gcc.dg/analyzer/taint-assert-macro-expansion.c: Likewise.
* gcc.dg/analyzer/taint-assert-system-header.c: Likewise.
* gcc.dg/analyzer/taint-assert.c: Likewise.
* gcc.dg/analyzer/taint-divisor-1.c: Likewise.
* gcc.dg/analyzer/taint-divisor-2.c: Likewise.
* gcc.dg/analyzer/taint-merger.c: Likewise.
* gcc.dg/analyzer/taint-ops.c: Delete this test: it was a
duplicate of material in operations.c and data-model-1.c, with
-fanalyzer-checker=taint added.
* gcc.dg/analyzer/taint-read-index-1.c: Remove use of
-fanalyzer-checker=taint.
* gcc.dg/analyzer/taint-read-offset-1.c: Likewise.
* gcc.dg/analyzer/taint-realloc.c: Likewise.  Add missing
dg-warning for leak now that the malloc state machine is also
active.
* gcc.dg/analyzer/taint-size-1.c: Remove use of
-fanalyzer-checker=taint.
* gcc.dg/analyzer/taint-size-access-attr-1.c: Likewise.
* gcc.dg/analyzer/taint-write-index-1.c: Likewise.
* gcc.dg/analyzer/taint-write-offset-1.c: Likewise.
* gcc.dg/analyzer/torture/taint-read-index-2.c: Likewise.
* gcc.dg/analyzer/torture/taint-read-index-3.c: Likewise.
* gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c: Likewise.  Add
-Wno-pedantic.
* gcc.dg/plugin/taint-CVE-2011-0521-1.c: Likewise.
* gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c: Likewise.
* gcc.dg/plugin/taint-CVE-2011-0521-2.c: Likewise.
* gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c: Likewise.
* gcc.dg/plugin/taint-CVE-2011-0521-3.c: Likewise.  Fix C++-style
comment.
* gcc.dg/plugin/taint-CVE-2011-0521-4.c: Remove use of
-fanalyzer-checker=taint and add -Wno-pedantic. Remove xfail and
add missing dg-warning.
* gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c: Remove use of
-fanalyzer-checker=taint and add -Wno-pedantic.
* gcc.dg/plugin/taint-CVE-2011-0521-5.c: Likewise.
* gcc.dg/plugin/taint-CVE-2011-0521-6.c: Likewise.
* gcc.dg/plugin/taint-antipatterns-1.c: : Remove use of
-fanalyzer-checker=taint.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
47 files changed:
gcc/analyzer/sm-taint.cc
gcc/analyzer/sm.cc
gcc/doc/invoke.texi
gcc/testsuite/c-c++-common/analyzer/attr-tainted_args-1.c
gcc/testsuite/c-c++-common/analyzer/fread-1.c
gcc/testsuite/c-c++-common/analyzer/pr104029.c
gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-signed-char.c
gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-unsigned-char.c
gcc/testsuite/gcc.dg/analyzer/pr93382.c
gcc/testsuite/gcc.dg/analyzer/switch-enum-taint-1.c
gcc/testsuite/gcc.dg/analyzer/taint-CVE-2011-2210-1.c
gcc/testsuite/gcc.dg/analyzer/taint-CVE-2020-13143-1.c
gcc/testsuite/gcc.dg/analyzer/taint-CVE-2020-13143-2.c
gcc/testsuite/gcc.dg/analyzer/taint-CVE-2020-13143.h
gcc/testsuite/gcc.dg/analyzer/taint-alloc-1.c
gcc/testsuite/gcc.dg/analyzer/taint-alloc-2.c
gcc/testsuite/gcc.dg/analyzer/taint-alloc-3.c
gcc/testsuite/gcc.dg/analyzer/taint-alloc-4.c
gcc/testsuite/gcc.dg/analyzer/taint-alloc-5.c
gcc/testsuite/gcc.dg/analyzer/taint-assert-BUG_ON.c
gcc/testsuite/gcc.dg/analyzer/taint-assert-macro-expansion.c
gcc/testsuite/gcc.dg/analyzer/taint-assert-system-header.c
gcc/testsuite/gcc.dg/analyzer/taint-assert.c
gcc/testsuite/gcc.dg/analyzer/taint-divisor-1.c
gcc/testsuite/gcc.dg/analyzer/taint-divisor-2.c
gcc/testsuite/gcc.dg/analyzer/taint-merger.c
gcc/testsuite/gcc.dg/analyzer/taint-ops.c [deleted file]
gcc/testsuite/gcc.dg/analyzer/taint-read-index-1.c
gcc/testsuite/gcc.dg/analyzer/taint-read-offset-1.c
gcc/testsuite/gcc.dg/analyzer/taint-realloc.c
gcc/testsuite/gcc.dg/analyzer/taint-size-1.c
gcc/testsuite/gcc.dg/analyzer/taint-size-access-attr-1.c
gcc/testsuite/gcc.dg/analyzer/taint-write-index-1.c
gcc/testsuite/gcc.dg/analyzer/taint-write-offset-1.c
gcc/testsuite/gcc.dg/analyzer/torture/taint-read-index-2.c
gcc/testsuite/gcc.dg/analyzer/torture/taint-read-index-3.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1-fixed.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-1.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2-fixed.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-2.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3-fixed.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-3.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-4.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c
gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c
gcc/testsuite/gcc.dg/plugin/taint-antipatterns-1.c

index 09c1e9368cdf0ba7765db0108db9b4c253867e0b..dfd5f7fa5d2c8c02d370a04dad28f3fdf552d251 100644 (file)
@@ -1,4 +1,4 @@
-/* An experimental state machine, for tracking "taint": unsanitized uses
+/* A state machine for tracking "taint": unsanitized uses
    of data potentially under an attacker's control.
 
    Copyright (C) 2019-2023 Free Software Foundation, Inc.
index 2b88430c0129dfe7436f382d2d12d82477456657..c030c272ccc0a9d68f8517c70ffcae0a06e64690 100644 (file)
@@ -188,10 +188,7 @@ make_checkers (auto_delete_vec <state_machine> &out, logger *logger)
   out.safe_push (make_malloc_state_machine (logger));
   out.safe_push (make_fileptr_state_machine (logger));
   out.safe_push (make_fd_state_machine (logger));
-  /* The "taint" checker must be explicitly enabled (as it currently
-     leads to state explosions that stop the other checkers working).  */
-  if (flag_analyzer_checker)
-    out.safe_push (make_taint_state_machine (logger));
+  out.safe_push (make_taint_state_machine (logger));
   out.safe_push (make_sensitive_state_machine (logger));
   out.safe_push (make_signal_state_machine (logger));
   out.safe_push (make_va_list_state_machine (logger));
index 2d30a5d47672716ed7cebc0464180f1f6e54ccf3..1748afdbfe0a48facadb308b8de2dc8fdb982999 100644 (file)
@@ -10415,6 +10415,12 @@ Enabling this option effectively enables the following warnings:
 -Wanalyzer-shift-count-negative
 -Wanalyzer-shift-count-overflow
 -Wanalyzer-stale-setjmp-buffer
+-Wanalyzer-tainted-allocation-size
+-Wanalyzer-tainted-array-index
+-Wanalyzer-tainted-assertion
+-Wanalyzer-tainted-divisor
+-Wanalyzer-tainted-offset
+-Wanalyzer-tainted-size
 -Wanalyzer-unsafe-call-within-signal-handler
 -Wanalyzer-use-after-free
 -Wanalyzer-use-of-pointer-in-stale-stack-frame
@@ -10426,13 +10432,6 @@ Enabling this option effectively enables the following warnings:
 -Wanalyzer-write-to-const
 -Wanalyzer-write-to-string-literal
 }
-@ignore
--Wanalyzer-tainted-allocation-size
--Wanalyzer-tainted-array-index
--Wanalyzer-tainted-divisor
--Wanalyzer-tainted-offset
--Wanalyzer-tainted-size
-@end ignore
 
 This option is only available if GCC was configured with analyzer
 support enabled.
@@ -10880,8 +10879,7 @@ no longer exists, and likely lead to a crash (or worse).
 @opindex Wanalyzer-tainted-allocation-size
 @opindex Wno-analyzer-tainted-allocation-size
 @item -Wno-analyzer-tainted-allocation-size
-This warning requires both @option{-fanalyzer} and
-@option{-fanalyzer-checker=taint} to enable it;
+This warning requires @option{-fanalyzer} which enables it;
 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
 
 This diagnostic warns for paths through the code in which a value
@@ -10896,8 +10894,7 @@ See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Alloc
 @opindex Wno-analyzer-tainted-assertion
 @item -Wno-analyzer-tainted-assertion
 
-This warning requires both @option{-fanalyzer} and
-@option{-fanalyzer-checker=taint} to enable it;
+This warning requires @option{-fanalyzer} which enables it;
 use @option{-Wno-analyzer-tainted-assertion} to disable it.
 
 This diagnostic warns for paths through the code in which a value
@@ -10958,8 +10955,7 @@ despite the above not being an assertion failure, strictly speaking.
 @opindex Wanalyzer-tainted-array-index
 @opindex Wno-analyzer-tainted-array-index
 @item -Wno-analyzer-tainted-array-index
-This warning requires both @option{-fanalyzer} and
-@option{-fanalyzer-checker=taint} to enable it;
+This warning requires @option{-fanalyzer} which enables it;
 use @option{-Wno-analyzer-tainted-array-index} to disable it.
 
 This diagnostic warns for paths through the code in which a value
@@ -10972,8 +10968,7 @@ See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Val
 @opindex Wanalyzer-tainted-divisor
 @opindex Wno-analyzer-tainted-divisor
 @item -Wno-analyzer-tainted-divisor
-This warning requires both @option{-fanalyzer} and
-@option{-fanalyzer-checker=taint} to enable it;
+This warning requires @option{-fanalyzer} which enables it;
 use @option{-Wno-analyzer-tainted-divisor} to disable it.
 
 This diagnostic warns for paths through the code in which a value
@@ -10986,8 +10981,7 @@ See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Ze
 @opindex Wanalyzer-tainted-offset
 @opindex Wno-analyzer-tainted-offset
 @item -Wno-analyzer-tainted-offset
-This warning requires both @option{-fanalyzer} and
-@option{-fanalyzer-checker=taint} to enable it;
+This warning requires @option{-fanalyzer} which enables it;
 use @option{-Wno-analyzer-tainted-offset} to disable it.
 
 This diagnostic warns for paths through the code in which a value
@@ -11000,8 +10994,7 @@ See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-o
 @opindex Wanalyzer-tainted-size
 @opindex Wno-analyzer-tainted-size
 @item -Wno-analyzer-tainted-size
-This warning requires both @option{-fanalyzer} and
-@option{-fanalyzer-checker=taint} to enable it;
+This warning requires @option{-fanalyzer} which enables it;
 use @option{-Wno-analyzer-tainted-size} to disable it.
 
 This diagnostic warns for paths through the code in which a value
@@ -11251,38 +11244,6 @@ call site, and that are sufficiently complicated (as per
 @item -fanalyzer-checker=@var{name}
 Restrict the analyzer to run just the named checker, and enable it.
 
-Some checkers are disabled by default (even with @option{-fanalyzer}),
-such as the @code{taint} checker that implements
-@option{-Wanalyzer-tainted-array-index}, and this option is required
-to enable them.
-
-@emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
-following warnings from @option{-fanalyzer}:
-
-@gccoptlist{
--Wanalyzer-deref-before-check
--Wanalyzer-double-fclose
--Wanalyzer-double-free
--Wanalyzer-exposure-through-output-file
--Wanalyzer-fd-access-mode-mismatch
--Wanalyzer-fd-double-close
--Wanalyzer-fd-leak
--Wanalyzer-fd-use-after-close
--Wanalyzer-fd-use-without-check
--Wanalyzer-file-leak
--Wanalyzer-free-of-non-heap
--Wanalyzer-malloc-leak
--Wanalyzer-mismatching-deallocation
--Wanalyzer-null-argument
--Wanalyzer-null-dereference
--Wanalyzer-possible-null-argument
--Wanalyzer-possible-null-dereference
--Wanalyzer-unsafe-call-within-signal-handler
--Wanalyzer-use-after-free
--Wanalyzer-va-list-leak
--Wanalyzer-va-list-use-after-va-end
-}
-
 @opindex fanalyzer-debug-text-art
 @opindex fno-analyzer-debug-text-art
 @item -fanalyzer-debug-text-art-headings
index 0ff344699671b7f10f1fb690469c8e7f4b20d933..3525e84b94b191d16924c0000b0b685232911648 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct arg_buf
index 593cb7f4aa0330ee04ea8bcdafa38bd082572ffc..467467ee8a6cb6fa2844170a4dc3aa05b4880da8 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 typedef __SIZE_TYPE__ size_t;
 
 extern size_t fread (void *, size_t, size_t, void *);
index 873f0eb16b7e2407924fd21689ab83f7aa38ad29..04b9ef872a3aaa23a20c710471449455d3352c80 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 typedef __SIZE_TYPE__ size_t;
 typedef const void *t_comptype;
 typedef int (*t_compfunc)(t_comptype, t_comptype);
index 1f3df7c211f425fdccd3d944152711871d97645a..45599e228b812924536b465913ed6ba49eb1368c 100644 (file)
@@ -6,6 +6,9 @@
 /* { dg-do "compile" } */
 /* { dg-additional-options "-fsigned-char" } */
 
+/* TODO (PR analyzer/112528): remove need for this.  */
+/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=40 --param analyzer-bb-explosion-factor=10" } */
+
 /* Minimal replacement of system headers.  */
 
 typedef __SIZE_TYPE__ size_t;
index db9678d1caa9102e6e6853e5b450976b91110beb..a59fc49c2b364a5fd23ddc7fcac85f0582108638 100644 (file)
@@ -6,6 +6,9 @@
 /* { dg-do "compile" } */
 /* { dg-additional-options "-funsigned-char" } */
 
+/* TODO (PR analyzer/112528): remove need for this.  */
+/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=40 --param analyzer-bb-explosion-factor=10" } */
+
 /* Minimal replacement of system headers.  */
 
 typedef __SIZE_TYPE__ size_t;
index 1e6612ddc050e3787bd0fbab44aaa736f977b787..91eab2192ad9c259c0b80010f96f13d8879bb180 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 typedef __SIZE_TYPE__ size_t;
 
 int idx;
index db3bb5b49473b17188151147a489a1325d552d40..d20b33e090b7d270de2c48a8b243412951768fc9 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 
 /* Verify the handling of "switch (enum_value)".  */
index b44be99356802bb7a44491dd413fb7a6dc3e74d1..fa89bda6f0f99d51cbe66ee920a50f5f6556fc38 100644 (file)
@@ -7,9 +7,6 @@
    Fixed in 3d0475119d8722798db5e88f26493f6547a4bb5b on linux-2.6.39.y
    in linux-stable.  */
 
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include "test-uaccess.h"
 
index 328c5799145fe95c268165b52ae1d90d04abca68..1b81c1bb1f84e26163bd4b504e27e3a8beb98d41 100644 (file)
@@ -1,9 +1,6 @@
 /* See notes in this header.  */
 #include "taint-CVE-2020-13143.h"
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 struct configfs_attribute {
        /* [...snip...] */
        ssize_t (*store)(struct config_item *, const char *, size_t) /* { dg-message "\\(1\\) field 'store' of 'struct configfs_attribute' is marked with '__attribute__\\(\\(tainted_args\\)\\)'" } */
index c74a460b01ef4bf48a0169689f2302fb73c0a273..f53e42bd6aa1361a4fa8bed2ec529955febeda77 100644 (file)
@@ -1,9 +1,6 @@
 /* See notes in this header.  */
 #include "taint-CVE-2020-13143.h"
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 struct configfs_attribute {
        /* [...snip...] */
        ssize_t (*store)(struct config_item *, const char *, size_t) /* { dg-message "\\(1\\) field 'store' of 'struct configfs_attribute' is marked with '__attribute__\\(\\(tainted_args\\)\\)'" } */
index 0ba023539af06aae5e3055d7fe552c7583e08241..93f90d490138c11ea032bd1b6cb646d91ad38868 100644 (file)
@@ -8,9 +8,6 @@
    Fixed by 15753588bcd4bbffae1cca33c8ced5722477fe1f on linux-5.7.y
    in linux-stable.  */
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include <stddef.h>
 
 /* Adapted from include/uapi/asm-generic/posix_types.h  */
index cb2db6c69cfc4261e9d5da4d491f21e924c960f3..dfb585bc613b6ff5e9abb511c7491c89983c2511 100644 (file)
@@ -1,5 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
 /* { dg-require-effective-target alloca } */
 
 #include "analyzer-decls.h"
index 72dbca5cbf085277c89687750146acbbef297a75..68fbce9188c241067541f7f5c5f06b8ecd084399 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include <stdio.h>
 #include <stdlib.h>
index 80d8f0b824793204bb49217b02da59f241904c53..ce6a3271d2ad27e9c1c74f2ef82faa96f69297e5 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include <stdio.h>
 #include <stdlib.h>
index bd47097b1d5f9a2142edd22c8420726659d7d987..9df9422491c879774a785e12ace9fdfe8e0c85de 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include <stdio.h>
 #include <stdlib.h>
index 9a159800c61971dae1f22f1659e3e730d169f0b9..18dbff0298ed925af157ac9458f3c37f793c406b 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 
 struct foo
index 8aef0a44a6d3f4b0f792b39ac625de67df750e6b..328940d29839b1512eee0570f2eaf9970951719f 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 /* We need this, otherwise the warnings are emitted inside the macros, which
    makes it hard to write the DejaGnu directives.  */
 /* { dg-additional-options " -ftrack-macro-expansion=0" } */
index 24b175a09734eac9dc39ea524b7c71bdb7185a68..78357ae62b82cee0518be4e9e5b9ea8294c1700d 100644 (file)
@@ -2,9 +2,6 @@
    -Wanalyzer-tainted-assertion with macro-tracking enabled
    (the default).  */
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 /* { dg-additional-options "-fdiagnostics-show-path-depths" } */
 /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
 
index a65853c7886a59ceb44fafddfb81a54bd1aaad7b..bd47ab79188697a884b432a34b8383f627fa6c12 100644 (file)
@@ -3,9 +3,6 @@
    (the default), where the assertion macro is defined in
    a system header.  */
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 /* { dg-additional-options "-fdiagnostics-show-path-depths" } */
 /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
 
index b09f8c51a1612f95dd67371f75a0f583bc1b2ae9..855ed5f705fc925ec5e0f198a364b20c990489d4 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 /* We need this, otherwise the warnings are emitted inside the macros, which
    makes it hard to write the DejaGnu directives.  */
 /* { dg-additional-options " -ftrack-macro-expansion=0" } */
index b7c1faef1c478f4dbc576098589ab1d0a8143bec..438a2095382c0ac5476240837f0d1037bea24467 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include <stdio.h>
 
index de9a1cb3a46f133114b73bb2b2d0506a8de49b1e..770258418fa5d103593c31c579751e2e2d7802a7 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 
 __attribute__ ((tainted_args))
index e4e48f3db03b4b2d0a87f6eb8b59cfbbe4de84eb..b7d562b9704a6fa82046fe2905b94320e10c90f0 100644 (file)
@@ -1,6 +1,3 @@
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-// TODO: remove need for this option
-
 #include "analyzer-decls.h"
 
 int v_start;
diff --git a/gcc/testsuite/gcc.dg/analyzer/taint-ops.c b/gcc/testsuite/gcc.dg/analyzer/taint-ops.c
deleted file mode 100644 (file)
index 729dbe5..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-// TODO: remove need for this option
-/* This test can probably be removed when -fanalyzer enables
-   the taint checker by default.  */
-
-#include "analyzer-decls.h"
-
-void
-test_1 (char a)
-{
-  char b = -a;
-}
-
-/* Copies of code from data-model-1.c.  */
-
-void test_20 (int i, int j)
-{
-  __analyzer_eval (i + 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i + j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i - 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i - j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i * 2); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i * j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i / 2); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i / j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i % 2); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i % j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i & 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i & j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i | 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i | j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i ^ 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i ^ j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i >> 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i >> j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i << 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i << j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i && 0); /* { dg-warning "FALSE" } */
-  __analyzer_eval (i && 1); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i && j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i || 0); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (i || 1); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i || j); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval (~i); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (-i); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (+i); /* { dg-warning "UNKNOWN" } */
-
-  /* Anything added above should be added to the next function also.  */
-}
-
-void test_21 (void)
-{
-  int i, j, zero;
-  int *pi = &i;
-  int *pj = &j;
-  int *pzero = &zero;
-  *pi = 5;
-  *pj = 3;
-  *pzero = 0;
-
-  __analyzer_eval (i + j == 8); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i - j == 2); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i * j == 15); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i / j == 1); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i % j == 2); /* { dg-warning "TRUE" } */
-
-  /* Division by zero.  */
-  // TODO: should we warn for this?
-  __analyzer_eval (i / zero); /* { dg-warning "UNKNOWN" } */
-  __analyzer_eval (i % zero); /* { dg-warning "UNKNOWN" } */
-
-  __analyzer_eval ((i & 1) == (5 & 1)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i & j) == (5 & 3)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i | 1) == (5 | 1)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i | j) == (5 | 3)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i ^ 1) == (5 ^ 1)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i ^ j) == (5 ^ 3)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i >> 1) == (5 >> 1)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i >> j) == (5 >> 3)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i << 1) == (5 << 1)); /* { dg-warning "TRUE" } */
-  __analyzer_eval ((i << j) == (5 << 3)); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i && 0); /* { dg-warning "FALSE" } */
-  __analyzer_eval (i && 1); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i && j); /* { dg-warning "TRUE" } */
-
-  __analyzer_eval (i || 0); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i || 1); /* { dg-warning "TRUE" } */
-  __analyzer_eval (i || j); /* { dg-warning "TRUE" } */
-
-  __analyzer_eval (~i == ~5); /* { dg-warning "TRUE" } */
-  __analyzer_eval (-i == -5); /* { dg-warning "TRUE" } */
-  __analyzer_eval (+i == +5); /* { dg-warning "TRUE" } */
-}
index 71c0816fd1febe76c734ab1bb52ac66ef4a466ab..1ec78b52629624e1d459f8904de47ac55fca438b 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 6db59bcc61541fae759f701235d70b5b1f25f0df..bb5d0930cdb2b4b540facce3d10cfc4a510ebab8 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index bd0ed0010fbb6dcd2cfe3a46a92b4591f0d3f147..aeefb7da2c12e6255909d4319a7d71bd2f4d2a4b 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -18,4 +15,4 @@ test_1 (size_t sz) /* { dg-message "\\(1\\) function 'test_1' marked with '__att
   __analyzer_dump_state ("taint", sz); /* { dg-warning "state: 'tainted'" } */
 
   q = realloc (p, sz);  /* { dg-warning "use of attacker-controlled value 'sz' as allocation size without upper-bounds checking" } */
-}
+} /* { dg-warning "leak of 'q'" } */
index 1fd5fd486c0d5f55608049f4166481de63d89ad6..36083ac5071a595dbf412ad164d4db389032fb3b 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include "analyzer-decls.h"
 #include <stdio.h>
 #include <stdlib.h>
index 7d243a9570f4aaab4a60201446d4779dd77ab039..d4da3d77fa13f28bf2fe6c4211474ceb4fe1f27a 100644 (file)
@@ -1,8 +1,7 @@
 /* Passing tainted sizes to external functions with attribute ((access)) with
    a size-index.  */
 
-// TODO: remove need for the explicit taint option:
-/* { dg-additional-options "-fanalyzer-checker=taint -fanalyzer-show-duplicate-count" } */
+/* { dg-additional-options "-fanalyzer-show-duplicate-count" } */
 
 #include "analyzer-decls.h"
 #include <stdio.h>
index cc7ab1ca4f6ecc5c24edbf49d545a5e2bd98c252..62222069578ca4b6b9e53808676eba982f60639d 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index d0df62203156f407a2f711d9d2f9b626fc455283..21794ce4cf8c42d37e14c47130a8685808edea80 100644 (file)
@@ -1,6 +1,3 @@
-// TODO: remove need for this option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index b3dc177cb14fa7140f699110181347a7031c14a3..81421330e8d0bc8e5522e2b2a5b6e13afd6a572a 100644 (file)
@@ -1,5 +1,3 @@
-// TODO: remove need for the taint option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
 /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
 
 #define LOWER_LIMIT 5
index 8eb6061a08ba0e481428d741a7ad59ca312d7d19..86bdedede7e72cd395259cc9f116d39d6a902049 100644 (file)
@@ -1,5 +1,3 @@
-// TODO: remove need for the taint option:
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
 /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
 
 struct raw_ep {
index 0ca8137c3ef3967006abc5d5946ec9a07e1c7892..51526b831c02b8158ec6722ca81b9f079154e382 100644 (file)
@@ -1,7 +1,6 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
 /* { dg-require-effective-target analyzer } */
+/* { dg-additional-options "-Wno-pedantic" } */
 
 /* See notes in this header.  */
 #include "taint-CVE-2011-0521.h"
index cde12b3b761ce331e7281a5469bd1b754045b880..3d11a75073c1e203f59918949974a448e6eff2b7 100644 (file)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-additional-options "-Wno-pedantic" } */
 /* { dg-require-effective-target analyzer } */
 
 /* See notes in this header.  */
index 8a211cefe4e5c79305bd4f2cd89aefe206dcd49a..d035266b16ade5068c9e444155ab88a2fa8319b9 100644 (file)
@@ -1,14 +1,10 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-additional-options "-Wno-pedantic" } */
 /* { dg-require-effective-target analyzer } */
 
 /* See notes in this header.  */
 #include "taint-CVE-2011-0521.h"
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 /* Adapted from drivers/media/dvb/ttpci/av7110_ca.c  */
 
 int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
index 30cab38e002f033827113661bca102eb22b56ee0..5270e22f1a320a98c845f2bf136d97e2fe2c89f9 100644 (file)
@@ -1,7 +1,6 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
 /* { dg-require-effective-target analyzer } */
+/* { dg-additional-options "-Wno-pedantic" } */
 
 /* See notes in this header.  */
 #include "taint-CVE-2011-0521.h"
index b7852b40dcf86dda99d3d9bbafa78b26c07a9295..b8268fa4a826af42d9996b580b512e2361b1ffbe 100644 (file)
@@ -1,14 +1,10 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
 /* { dg-require-effective-target analyzer } */
+/* { dg-additional-options "-Wno-pedantic" } */
 
 /* See notes in this header.  */
 #include "taint-CVE-2011-0521.h"
 
-// TODO: remove need for this option
-/* { dg-additional-options "-fanalyzer-checker=taint" } */
-
 /* Adapted from drivers/media/dvb/ttpci/av7110_ca.c  */
 
 int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
index 6b9e034eea77514f3b7e571b5099f583b2a85261..86868a017c4c4637a0427b3370db723fb04de049 100644 (file)
@@ -1,7 +1,6 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
 /* { dg-require-effective-target analyzer } */
+/* { dg-additional-options "-Wno-pedantic" } */
 
 /* See notes in this header.  */
 #include "taint-CVE-2011-0521.h"
@@ -21,7 +20,7 @@ int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
                if (info->num > 1)
                        return -EINVAL;
                av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */
-               // TODO(xfail)
+               /* TODO(xfail).  */
                av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
                                                        CA_CI_LINK : CA_CI;
                memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
index f314c64ce70cbaaba5cab5bcd28dc2b602559db8..06b3468fca58d970e6ee306beb84fe3350bc45cf 100644 (file)
@@ -1,8 +1,7 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
 // TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-options "-fanalyzer --param=analyzer-max-svalue-depth=25" } */
+/* { dg-additional-options "-Wno-pedantic" } */
 /* { dg-require-effective-target analyzer } */
 
 /* See notes in this header.  */
@@ -32,11 +31,10 @@ int test_1(struct file *file, unsigned int cmd, unsigned long arg)
 
                if (info->num > 1)
                        return -EINVAL;
-               av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" "" { xfail *-*-* } } */
-               // TODO(xfail)
-               av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
+               av7110->ci_slot[info->num].num = info->num; /* { dg-warning "attacker-controlled value" } */
+               av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? /* { dg-warning "attacker-controlled value" } */
                                                        CA_CI_LINK : CA_CI;
-               memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
+               memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));  /* { dg-warning "attacker-controlled value" } */
        }
 
        copy_to_user((void __user *)arg, parg, sizeof(sbuf));
index 2e74770a7a33f5656daafc37ec528454e52b0147..076ada3a20a84cc6fe3fc2fe424cf6a7f17e5d6f 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
 // TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-options "-fanalyzer --param=analyzer-max-svalue-depth=25" } */
+/* { dg-additional-options "-Wno-pedantic" } */
 /* { dg-require-effective-target analyzer } */
 
 /* On darwin, system headers are fortified, which defeats the analysis.  Turn it off.  */
index 021d458b66ef78e6925269606c6d52e0677766c9..e27ee469df8f44fc06475b2f30e15d0f30f670e4 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
 // TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-options "-fanalyzer --param=analyzer-max-svalue-depth=25" } */
+/* { dg-additional-options "-Wno-pedantic" } */
 /* { dg-require-effective-target analyzer } */
 
 /* On darwin, system headers are fortified, which defeats the analysis.  Turn it off.  */
index f27e9eb5f02093b97f506f0fbbb0298ce7f8e696..fea70ee57617d0ee2400cb9235db03e10d5eb3b1 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
 // TODO: remove need for --param=analyzer-max-svalue-depth=25 here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */
+/* { dg-options "-fanalyzer --param=analyzer-max-svalue-depth=25" } */
+/* { dg-additional-options "-Wno-pedantic" } */
 /* { dg-require-effective-target analyzer } */
 
 /* On darwin, system headers are fortified, which defeats the analysis.  Turn it off.  */
index 6bb6f1be25cab3b1ea9b9353829a1a34adce15cd..cdd9a4f1f50f2f9fe4b28d21afcba817c5d304ba 100644 (file)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-// TODO: remove need for -fanalyzer-checker=taint here:
-/* { dg-options "-fanalyzer -fanalyzer-checker=taint" } */
+/* { dg-options "-fanalyzer" } */
 /* { dg-require-effective-target analyzer } */
 
 #include "test-uaccess.h"