The ASTREE Static Analysis Tool

The ASTREE Static Analysis Tool

Abstract Interpretation « The Astrée Static Analysis Tool » There are two fundamental concepts in computer science (and in sciences in general) : – Abstraction : to reason on complex systems Patrick Cousot – Approximation : to make effective undecidable com- École normale supérieure putations 45 rue d’Ulm, 75230 Paris cedex 05, France [email protected] www.di.ens.fr/~cousot These concepts are formalized by abstract interpretation References [POPL ’77] P. Cousot and R. Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction ES_PASS Workshop — Berlin — 16–17 October 2007 or approximation of fixpoints. In 4th ACM POPL. [Thesis ’78] P. Cousot. Méthodes itératives de construction et d’approximation de points fixes d’opérateurs monotones sur un treillis, analyse sémantique de programmes. Thèse ès sci. math. Grenoble, march 1978. [POPL ’79] P. Cousot & R. Cousot. Systematic design of program analysis frameworks. In 6th ACM POPL. ES_PASS Workshop, 16-17/10/2007 — 1 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 3 — ľ P. Cousot 1. Informal Introduction to Ab- stract Interpretation Principle of Abstraction ES_PASS Workshop, 16-17/10/2007 — 2 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 4 — ľ P. Cousot Operational semantics Test/Debugging is Unsafe x(t) x(t) t t ES_PASS Workshop, 16-17/10/2007 — 5 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 7 — ľ P. Cousot Safety property Bounded Model Checking is Unsafe x(t) x(t) t t ES_PASS Workshop, 16-17/10/2007 — 6 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 8 — ľ P. Cousot Over-Approximation (Cont’d) x(t) Soundness and Incompleteness t ES_PASS Workshop, 16-17/10/2007 — 9 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 11 — ľ P. Cousot Abstract Interpretation is Sound Soundness Requirement: Erroneous Abstraction 1 x(t) x(t) t t 1 This situation is always excluded in static analysis by abstract interpretation. ES_PASS Workshop, 16-17/10/2007 — 10 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 12 — ľ P. Cousot Soundness Requirement: Erroneous Abstraction 2 x(t) 2. The Astrée static analyzer http://www.astree.ens.fr/ t 2 This situation is always excluded in static analysis by abstract interpretation. ES_PASS Workshop, 16-17/10/2007 — 13 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 15 — ľ P. Cousot Imprecision ) False Alarms Project Members x(t) Bruno Blanchet 3 Patrick Cousot Radhia Cousot Jérôme Feret Laurent Mauborgne Antoine Miné David Monniaux 4 Xavier Rival t 3 Nov. 2001 —– Nov. 2003. 4 Nov. 2001 —– Aug. 2007. ES_PASS Workshop, 16-17/10/2007 — 14 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 16 — ľ P. Cousot – with (cont’d) - union NEW [Min06a] - pointer arithmetics & casts NEW [Min06a] Programs Analyzed by Astrée – without - dynamic memory allocation and their Semantics - recursive function calls - unstructured/backward branching - conflicting side effects - C libraries, system calls (parallelism) Such limitations are quite common for embedded safety-critical software. ES_PASS Workshop, 16-17/10/2007 — 17 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 19 — ľ P. Cousot Programs analysed by Astrée The Class of Considered Periodic Synchronous Programs volatile input, state and output variables; – Application Domain: large safety critical embedded declare initialize state and output variables; real-time synchronous software for non-linear control loop forever of very complex control/command systems. - read volatile input variables, – C programs: - compute output and state variables, - write to output variables; - with __ASTREE_wait_for_clock (); ´ basic numeric datatypes, structures and arrays end loop ´ pointers (including on functions), Task scheduling is static: ´ floating point computations – Requirements: the only interrupts are clock ticks; ´ tests, loops and function calls – Execution time of loop body less than a clock tick, ´ limited branching (forward goto, break, continue) as verified by the aiT WCET Analyzers [1FHL] +0 . ES_PASS Workshop, 16-17/10/2007 — 18 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 20 — ľ P. Cousot Concrete Operational Semantics – International norm of C (ISO/IEC 9899:1999) – restricted by implementation-specific behaviors depend- ing upon the machine and compiler (e.g. representa- tion and size of integers, IEEE 754-1985 norm for floats and doubles) Specification Proved by Astrée – restrictedby user-defined programming guidelines (such as no modular arithmetic for signed integers, even though this might be the hardware choice) – restricted by program specific user requirements (e.g. assert, execution stops on first runtime error 5) 5 semantics of C unclear after an error, equivalent if no alarm ES_PASS Workshop, 16-17/10/2007 — 21 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 23 — ľ P. Cousot Different Classes of Run-time Errors Implicit Specification: Absence of Runtime Errors 1. Errors terminating the execution 6. Astrée warns and continues by taking into account only the executions that did not trigger the error. – No violation of the norm of C (e.g. array index out of 2. Errors not terminating the execution with predictable outcome 7. bounds, division by zero) Astrée warns and continues with worst-case assumptions. – No implementation-specific undefined behaviors (e.g. 3. Errors not terminating the execution with unpredictable maximum short integer is 32767, NaN) 8 Astrée outcome . warns and continues by taking into ac- – No violation of the programming guidelines (e.g. static count only the executions that did not trigger the error. variables cannot be assumed to be initialized to 0) ) Astrée is sound with respect to C standard, unsound with – No violation of the programmer assertions (must all respect to C implementation, unless no false alarm. be statically verified). 6 floating-point exceptions e.g. (invalid operations, overflows, etc.) when traps are activated 7 e.g. overflows over signed integers resulting in some signed integer. 8 e.g. memory corruptionss. ES_PASS Workshop, 16-17/10/2007 — 22 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 24 — ľ P. Cousot Simple congruences x = 19 mod 77 y y = 20 mod 99 Examples of General Purpose Abstractions Used by Astrée Non-relational x Best abstraction. 10 Ph. Granger. Static Analysis of Arithmetical Congruences. Int. J. Comput. Math. 30, 1989, pp. 165–190. ES_PASS Workshop, 16-17/10/2007 — 25 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 27 — ľ P. Cousot Intervals 9 Intervals & Simple Congruences x 2 [19; 77] y 2 [20; 07] % cat -n congruence.c 1 /* congruence.c */ 2 int main() Non-relational 3 { int X; 4 X = 0; Best abstraction. 5 while (X <= 128) 6 { X = X + 4; }; 7 __ASTREE_log_vars((X)); 8 } % astree congruence.c –no-relational –exec-fn main |& egrep "(WARN)|(X in)" direct = <integers (intv+cong+bitfield+set): X in {132} /\ Top > % 9 P. Cousot & R. Cousot. Static determination of dynamic properties of programs. Proc. 2nd Int. Symp. on Programming, Dunod, 1976. ES_PASS Workshop, 16-17/10/2007 — 26 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 28 — ľ P. Cousot Symbolic abstract domain [Min04a, Min04b] Boolean Relations for Boolean Control – Code Sample: – Interval analysis: if x 2 [a;b] and y 2 [c;d] then x`y 2 /* boolean.c */ B [a`d; b`c] so if 0x;2 [ 100] then x`x 2 [`100; 100]!!! typedef enum {F=0,T=1} BOOL; T F BOOL B; – The symbolic abstract domain propagates the sym- void main () { B0 B0 T F T F bolic values of variables and performs simplifications; unsigned int X, Y; while (1) { Y Y Y – Must maintain the maximal possible rounding error ... B = (X == 0); X X X for float computations (overestimated with intervals); ... % cat -n x-x.c 1 void main () { int X, Y; if (!B) { 2 __ASTREE_known_fact(((0 <= X) && (X <= 100))); Y = 1 / X; The boolean relation abstract do- 3 Y = (X - X); } main is parameterized by the height 4 __ASTREE_log_vars((Y)); 5 } ... of the decision tree (an analyzer astree –exec-fn main –no-relational x-x.c astree –exec-fn main x-x.c } option) and the abstract domain at Call [email protected]:1:5-x-x.c:1:9: Call [email protected]:1:5-x-x.c:1:9: } the leafs <interval: Y in [-100, 100]> <interval: Y in {0}> <symbolic: Y = (X -i X)> ES_PASS Workshop, 16-17/10/2007 — 29 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 31 — ľ P. Cousot Octagons (Automatic) Parameterization 1 » x » 9 – All abstract domains of Astrée are parameterized, 8 x + y » 77 e.g. > <> 1 » y » 9 - variable packing for octagones and decision trees, x ` y » 99 - partition/merge program points, > :> - loop unrollings, Weakly relational - thresholds in widenings, . ; Best abstraction. – End-users can either parameterize by hand (analyzer options, directives in the code), or – choose the automatic parameterization (default options, 11 A. Miné. A New Numerical Abstract Domain Based on Difference-Bound Matrices. PADO’2001. directives for pattern-matched predefined program sche- LNCS 2053, pp. 155–172. Springer 2001. See the The Octagon Abstract Domain Library on http://www.di.ens.fr/~mine/oct/ mata). ES_PASS Workshop, 16-17/10/2007 — 30 — ľ P. Cousot ES_PASS Workshop, 16-17/10/2007 — 32 — ľ P. Cousot Static Analysis with Astrée % cat -n modulo.c 1 int main () { 2 int x,y; 3 x = -2147483647 / -1; 4 y = ((-x) -1) / -1; 5 __ASTREE_log_vars((x,y)); 6 } Modular Arithmetic 7 % astree –exec-fn main –unroll 0 modulo.c\ |& egrep -A 1 "(<integers)|(WARN)" modulo.c:4.4-18::[call#main@1:]: WARN: signed int arithmetic range {2147483648} not included in [-2147483648, 2147483647] <integers (intv+cong+bitfield+set): y in [-2147483648, 2147483647] /\ Top, x in {2147483647} /\ {2147483647} > Astrée signals the overflow and goes on with an unkown value. ES_PASS Workshop, 16-17/10/2007 — 33 — ľ P.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    17 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us