Skip to content
  1. Jan 07, 2012
    • Anna Zaks's avatar
      [analyzer] Add basic format string vulnerability checking. · 126a2ef9
      Anna Zaks authored
      We already have a more conservative check in the compiler (if the
      format string is not a literal, we warn). Still adding it here for
      completeness and since this check is stronger - only triggered if the
      format string is tainted.
      
      llvm-svn: 147714
      126a2ef9
  2. Jan 06, 2012
    • Ted Kremenek's avatar
      [analyzer] Make the entries in 'Environment' context-sensitive by making entries map from · 632e3b7e
      Ted Kremenek authored
      (Stmt*,LocationContext*) pairs to SVals instead of Stmt* to SVals.
      
      This is needed to support basic IPA via inlining.  Without this, we cannot tell
      if a Stmt* binding is part of the current analysis scope (StackFrameContext) or
      part of a parent context.
      
      This change introduces an uglification of the use of getSVal(), and thus takes
      two steps forward and one step back.  There are also potential performance implications
      of enlarging the Environment.  Both can be addressed going forward by refactoring the
      APIs and optimizing the internal representation of Environment.  This patch
      mainly introduces the functionality upon when we want to build upon (and clean up).
      
      llvm-svn: 147688
      632e3b7e
  3. Jan 05, 2012
    • Anna Zaks's avatar
      [analyzer] Be less pessimistic about invalidation of global variables · 8158ef0d
      Anna Zaks authored
      as a result of a call.
      
      Problem:
      Global variables, which come in from system libraries should not be
      invalidated by all calls. Also, non-system globals should not be
      invalidated by system calls.
      
      Solution:
      The following solution to invalidation of globals seems flexible enough
      for taint (does not invalidate stdin) and should not lead to too
      many false positives. We split globals into 3 classes:
      
      * immutable - values are preserved by calls (unless the specific
      global is passed in as a parameter):
           A :  Most system globals and const scalars
      
      * invalidated by functions defined in system headers:
           B: errno
      
      * invalidated by all other functions (note, these functions may in
      turn contain system calls):
           B: errno
           C: all other globals (which are not in A nor B)
      
      llvm-svn: 147569
      8158ef0d
    • Ted Kremenek's avatar
      Fix 80 col violations. · 778d2bb8
      Ted Kremenek authored
      llvm-svn: 147566
      778d2bb8
  4. Jan 04, 2012
  5. Dec 29, 2011
  6. Dec 23, 2011
  7. Dec 22, 2011
  8. Dec 17, 2011
    • Anna Zaks's avatar
      [analyzer] Add support for taint flowing through a function (atoi). · 3b0ab206
      Anna Zaks authored
      Check if the input parameters are tainted (or point to tainted data) on
      a checkPreStmt<CallExpr>. If the output should be tainted, record it in
      the state. On post visit (checkPostStmt<CallExpr>), use the state to
      make decisions (in addition to the existing logic). Use this logic for
      atoi and fscanf.
      
      llvm-svn: 146793
      3b0ab206
  9. Dec 16, 2011
  10. Dec 14, 2011
  11. Dec 11, 2011
    • Anna Zaks's avatar
      [analyzer] CStringChecker should not rely on the analyzer generating... · 7c96b7db
      Anna Zaks authored
      [analyzer] CStringChecker should not rely on the analyzer generating UndefOrUnknown value when it cannot reason about the expression.
      
      We are now often generating expressions even if the solver is not known to be able to simplify it. This is another cleanup of the existing code, where the rest of the analyzer and checkers should not base their logic on knowing ahead of the time what the solver can reason about. 
      
      In this case, CStringChecker is performing a check for overflow of 'left+right' operation. The overflow can be checked with either 'maxVal-left' or 'maxVal-right'. Previously, the decision was based on whether the expresion evaluated to undef or not. With this patch, we check if one of the arguments is a constant, in which case we know that 'maxVal-const' is easily simplified. (Another option is to use canReasonAbout() method of the solver here, however, it's currently is protected.)
      
      This patch also contains 2 small bug fixes:
       - swap the order of operators inside SValBuilder::makeGenericVal.
       - handle a case when AddeVal is unknown in GenericTaintChecker::getPointedToSymbol.
      
      llvm-svn: 146343
      7c96b7db
  12. Dec 08, 2011
  13. Dec 07, 2011
  14. Dec 05, 2011
  15. Dec 01, 2011
  16. Nov 30, 2011
  17. Nov 18, 2011
  18. Nov 16, 2011
    • Benjamin Kramer's avatar
      Update CMake build. · de2ac70c
      Benjamin Kramer authored
      llvm-svn: 144829
      de2ac70c
    • Anna Zaks's avatar
      [analyzer] Catch the first taint propagation implied buffer overflow. · 20829c90
      Anna Zaks authored
      Change the ArrayBoundCheckerV2 to be more aggressive in reporting buffer overflows
      when the offset is tainted. Previously, we did not report bugs when the state was
      underconstrained (not enough information about the bound to determine if there is
      an overflow) to avoid false positives. However, if we know that the buffer
      offset is tainted - comes in from the user space and can be anything, we should
      report it as a bug.
      
      + The very first example of us catching a taint related bug.
      This is the only example we can currently handle. More to come...
      
      llvm-svn: 144826
      20829c90
    • Anna Zaks's avatar
      [analyzer] Adding generic taint checker. · 5c5bf9b6
      Anna Zaks authored
      The checker is responsible for defining attack surface and adding taint to symbols.
      
      llvm-svn: 144825
      5c5bf9b6
    • Anna Zaks's avatar
      [analyzer] Factor getCalleeName to the checker context. · 3888aa4b
      Anna Zaks authored
      many checkers are trying to get a name of the callee when visiting
      a CallExpr, so provide a convenience API.
      
      llvm-svn: 144820
      3888aa4b
  19. Nov 14, 2011
  20. Nov 10, 2011
  21. Nov 08, 2011
    • Anna Zaks's avatar
      [analyzer] Remove redundant check from DivZeroChecker · 0d58033b
      Anna Zaks authored
      Analysis by Ted:
      "
          if (stateZero && !stateNotZero) {
      
      is checking to see if:
      
        (A)  "it is possible for the value to be zero"   (stateZero)
      
          AND
      
        (B) "it is not possible for the value to be non-zero"  (!stateNotZero)
      
      That said, the only way for both B to be true AND A to be false is if the path is completely infeasible by the time we reach the divide-by-zero check.  For the most part (all cases?), such cases should automatically get pruned out at branches (i.e., an infeasible path gets dropped), which is the case in our tests.  So the question is whether or not such an infeasible path might not get dropped earlier?  I can't envision any right now.
      
      Indeed, the rest of the checker assumes that if the bug condition didn't fire then 'stateNotZero' is non-NULL:
      
          C.addTransition(stateNotZero);
      "
      
      llvm-svn: 144114
      0d58033b
  22. Nov 05, 2011
  23. Nov 01, 2011
  24. Oct 28, 2011
Loading