Automatic Qualification of Abstract Interpretation-based Static Analysis Tools. Christian Ferdinand, Daniel Kästner AbsInt GmbH 2013

Similar documents
StackAnalyzer Proving the Absence of Stack Overflows

Unit Testen en embedded software Fout injectie en Software varianten

Safety Manual. for ait, Astrée, StackAnalyzer. AbsInt Angewandte Informatik GmbH

ait: WORST-CASE EXECUTION TIME PREDICTION BY STATIC PROGRAM ANALYSIS

Efficient Verification of Non-Functional Safety Properties by Abstract Interpretation: Timing, Stack Consumption, and Absence of Runtime Errors

Simulink 모델과 C/C++ 코드에대한매스웍스의정형검증툴소개 The MathWorks, Inc. 1

Static Analysis by A. I. of Embedded Critical Software

Widening Operator. Fixpoint Approximation with Widening. A widening operator 2 L ˆ L 7``! L is such that: Correctness: - 8x; y 2 L : (y) v (x y)

Static Memory and Timing Analysis of Embedded Systems Code

Implementation and Verification Daniel MARTINS Application Engineer MathWorks

Timing Analysis. Dr. Florian Martin AbsInt

Static Analysis in C/C++ code with Polyspace

Data-Flow Based Detection of Loop Bounds

Leveraging Formal Methods for Verifying Models and Embedded Code Prashant Mathapati Application Engineering Group

The Verification Grand Challenge and Abstract Interpretation

Jay Abraham 1 MathWorks, Natick, MA, 01760

Towards an industrial use of FLUCTUAT on safety-critical avionics software

AstréeA From Research To Industry

Static Analysis of Embedded Systems

ABSTRACT INTERPRETATION

Intro to Proving Absence of Errors in C/C++ Code

State of Practice. Automatic Verification of Embedded Control Software with ASTRÉE and beyond

WHITE PAPER. 10 Reasons to Use Static Analysis for Embedded Software Development

A Gentle Introduction to Program Analysis

Structuring an Abstract Interpreter through Value and State Abstractions: EVA, an Evolved Value Analysis for Frama C

Verification and Test with Model-Based Design

Research on the Static Analysis Method of the Localization Embedded Platform Software Code Zhijie Gaoa, Ling Lu, Wen Jiao

Static Analysis methods and tools An industrial study. Pär Emanuelsson Ericsson AB and LiU Prof Ulf Nilsson LiU

Technical presentation

Verasco: a Formally Verified C Static Analyzer

Static analysis of concurrent avionics software


From Design to Production

IDE for medical device software development. Hyun-Do Lee, Field Application Engineer

Building a specialized static analyzer

Static Analysis and Verification of Aerospace Software

Model-Based Design for High Integrity Software Development Mike Anthony Senior Application Engineer The MathWorks, Inc.

Advanced Programming Methods. Introduction in program analysis

Seminar in Software Engineering Presented by Dima Pavlov, November 2010

Precise and Efficient FIFO-Replacement Analysis Based on Static Phase Detection

Certification Authorities Software Team (CAST) Position Paper CAST-25

Program Static Analysis. Overview

Formal proofs of code generation and verification tools

Leveraging Formal Methods Based Software Verification to Prove Code Quality & Achieve MISRA compliance

Semantics and Validation Lecture 1. Informal Introduction

Applications of Program analysis in Model-Based Design

Relational Abstract Domains for the Detection of Floating-Point Run-Time Errors

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak

Using Model-Based Design in conformance with safety standards

How much is a mechanized proof worth, certification-wise?

Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems)

Developing AUTOSAR Compliant Embedded Software Senior Application Engineer Sang-Ho Yoon

automatisiertensoftwaretests

Static Program Analysis Part 1 the TIP language

Standardkonforme Absicherung mit Model-Based Design

Verification and Validation of High-Integrity Systems

Improving Timing Analysis for Matlab Simulink/Stateflow

Automating Best Practices to Improve Design Quality

Lecture 6. Abstract Interpretation

Verification of Embedded Software: Problems and Perspectives

Hierarchical Shape Abstraction of Dynamic Structures in Static Blocks

Static and dynamic analysis: synergy and duality

CSC313 High Integrity Systems/CSCM13 Critical Systems. CSC313/CSCM13 Chapter 1 1/ 38

Production Code Generation and Verification for Industry Standards Sang-Ho Yoon Senior Application Engineer

A Formally-Verified C static analyzer

Why AI + ILP is good for WCET, but MC is not, nor ILP alone

Design and Analysis of Time-Critical Systems Introduction

Script started on Mon Oct 15 08:21: demo-astree/programs %./README

Timing analysis and timing predictability

Program Verification. Aarti Gupta

Static Analysis. Systems and Internet Infrastructure Security

An Eclipse Plug-in for Model Checking

Why does ASTRÉE scale up?

Classification of Code Annotations and Discussion of Compiler-Support for Worst-Case Execution Time Analysis

Verification and Validation of Models for Embedded Software Development Prashant Hegde MathWorks India Pvt. Ltd.

Automatización de Métodos y Procesos para Mejorar la Calidad del Diseño

Don t Be the Developer Whose Rocket Crashes on Lift off LDRA Ltd

4/24/18. Overview. Program Static Analysis. Has anyone done static analysis? What is static analysis? Why static analysis?

An Approach to Behavioral Subtyping Based on Static Analysis

A Comparison of SPARK with MISRA C and Frama-C

Guidelines for deployment of MathWorks R2010a toolset within a DO-178B-compliant process

The Apron Library. Bertrand Jeannet and Antoine Miné. CAV 09 conference 02/07/2009 INRIA, CNRS/ENS

Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff;

Timing Analysis of Parallel Software Using Abstract Execution

Program Verification (6EC version only)

Program verification. Generalities about software Verification Model Checking. September 20, 2016

Design and Implementation of a Special-Purpose Static Program Analyzer for Safety-Critical Real-Time Embedded Software

Critical Analysis of Computer Science Methodology: Theory

Static program checking and verification

A Context-Sensitive Memory Model for Verification of C/C++ Programs

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. !

Hardware-Software Codesign. 9. Worst Case Execution Time Analysis

RISC-V CUSTOMIZATION WITH STUDIO 8

Design and Analysis of Real-Time Systems Microarchitectural Analysis

Space Software Validation using Abstract Interpretation

MONIKA HEINER.

Static Analysis: Overview, Syntactic Analysis and Abstract Interpretation TDDC90: Software Security

Lectures 20, 21: Axiomatic Semantics

the assembly level, since part of the structure of the program is lost at compile time the control structure is rather terse (branching to program poi

Transcription:

Automatic Qualification of Abstract Interpretation-based Static Analysis Tools Christian Ferdinand, Daniel Kästner AbsInt GmbH 2013

2 Functional Safety Demonstration of functional correctness Well-defined criteria Automated and/or model-based testing Formal techniques: model checking, theorem proving Satisfaction of non-functional requirements No crashes due to runtime errors (Division by zero, invalid pointer accesses, overflow and rounding errors) Resource usage: Timing requirements (e.g. WCET, WCRT) Memory requirements (e.g. no stack overflow) Insufficient: Tests & Measurements Test end criteria unclear No full coverage possible "Testing, in general, cannot show the absence of errors." [DO-178B/DO-178C] Formal technique: Abstract Interpretation Required by DO-178B / DO-178C / ISO-26262, EN-50128, IEC-61508 Required by DO-178B / DO-178C / ISO-26262, EN-50128, IEC-61508

3 Static Analysis an Overview General Definition: results are only computed from the program structure, without executing the program under analysis. Classification Syntax-based: Style checkers (e.g. MISRA-C) Unsound semantics-based: Bug-finders / bug-hunters. Can find some bugs, but cannot guarantee that all bugs are found. Examples: Splint, Coverity CMC, Klocwork K7, CodeSonar, Sound semantics-based / Abstract Interpretation-based Can guarantee that all bugs (from the class under analysis) are found. Results valid for every possible program execution with any possible input scenario. Examples: ait, StackAnalyzer, Polyspace Verifier, Astrée.

4 Abstract Interpretation (AI) Most interesting program properties are undecidable in the concrete semantics. Thus: concrete semantics mapped to abstract semantics where program properties are decidable (efficiency-precision tradeoff). This makes analysis of large software projects feasible. Soundness: A static analysis is said to be sound when the data flow information it produces is guaranteed to be true for every possible program execution. Formally provable by Abstract Interpretation. Safety: Computation of safe overapproximation of program semantics: some precision may be lost, but imprecision is always on the safe side. Concrete semantics Abstract semantics potentially false Definitely correct / in time definitely false Definitely correct / in time

5 AI Industry Perspective Abstract Interpretation-based static analyzers are in wide industrial use: state-of-the-art for validating non-functional safety properties. Examples: Static WCET and memory usage analysis (ait, StackAnalyzer) Static runtime error analysis (Astrée) ait and StackAnalyzer are in wide use by avionics companies, e.g., for safety-critical Airbus software in many airplane types (A380, ). The ait WCET Analyzer has been used by NASA as an industrystandard tool for demonstrating the absence of timing-related software defects in the Toyota Motor Corporation Unintended Acceleration Investigation (2010) *. * Technical Support to the National Highway Traffic Safety Administration (NHTSA) on the Reported Toyota Motor Corporation (TMC) Unintended Acceleration (UA) Investigation.

6 ait WCET Analyzer combines Static WCET Analysis global static program analysis by Abstract Interpretation: microarchitecture analysis (caches, pipelines, ) + value analysis integer linear programming for path analysis to provide safe and precise bounds on the worst-case execution time (WCET). Application Code void Task (void) { variable++; function(); next++: if (next) do this; terminate() } Specifications (*.ais) clock 10200 khz ; loop "_codebook" + 1 loop exactly 16 end ; recursion "_fac" max 6; SNIPPET "printf" IS NOT ANALYZED AND TAKES MAX 333 CYCLES; flow "U_MOD" + 0xAC bytes / "U_MOD" + 0xC4 bytes is max 4; area from 0x20 to 0x497 is read-only; Entry Point Compiler Linker ait Executable (*.elf / *.out) Worst Case Execution Time Visualization, Documentation

7 Static Stack Usage Analysis The required stack space has to be reserved for each task at configuration time => maximal stack usage has to be statically known. Underestimating the maximal stack usage can cause stack overflows. StackAnalyzer is an Abstract Interpretation based static analyzer which calculates safe and precise upper bounds of the maximal stack usage of the tasks in the system. It can prove the absence of stack overflows: on binary code without code modification without debug information taking into account loops and recursions taking into account inline assembly and library function calls

8 Astrée: Runtime Error Analysis AI-based static analyzer to prove the absence of runtime errors in C99 code. Astrée detects all runtime errors with few false alarms: Array index out of bounds Integer/floating-point division by 0 Invalid pointer dereferences Arithmetic overflows and wrap-arounds Floating point overflows and invalid operations (IEEE floating values Inf and NaN) + User-defined assertions, unreachable code, uninitialized variables Efficient support for alarm analysis (variable values, contexts, ). Elimination of false alarms by local tuning of analysis precision. ALARM: invalid dereference: dereferencing 1 byte(s) at offset(s) 10 may overflow the variable ArrayBlock of byte-size 10 at [ ]

9 The Confidence Argument Absence of hazards has to be shown with adequate confidence: the evidence provided can be trusted beyond reasonable doubt. Abstract Interpretation is a formal verification method enabling provably sound analyses to be designed. Reasoning strategy: 1. Soundness proof of mathematical analysis specification. 2. Automatic generation of analyzer implementation from mathematical specification, enabling high implementation quality. 3. Empirical validation of chosen abstraction, i.e., analysis model. 4. Qualification Support Kits: demonstrating implementation correctness in operational context of tool users. 5. Qualification Software Life Cycle Data reports: soundness of tool development and validation process.

10 Abstract Interpretation Theory & Soundness Proofs P. Cousot and R. Cousot. Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. Proceedings of the 4th ACM SIGACT- SIGPLAN Symposium on Principles of Programming Languages (POPL), 1977. P. Cousot. Semantic foundations of program analysis. In S. Muchnick and N. Jones, editors, Program Flow Analysis: Theory and Applications. Prentice-Hall, 1981. ait/stackanalyzer C. Ferdinand. Cache Behavior Prediction for Real-Time Systems. PhD thesis, Saarland University, 1997. S. Thesing. Safe and Precise WCET Determination by Abstract Interpretation of Pipeline Models. PhD thesis, Saarland University, 2004. C. Cullmann. Cache Persistence Analysis for Embedded Real-Time Systems. PhD thesis, Saarland University, 2013. Astrée A. Miné. Weakly Relational Numerical Abstract Domains. PhD thesis. École polytechnique en informatique, École polytechnique, Palaiseau, 2004. L. Mauborgne and X. Rival. Trace partitioning in abstract interpretation based static analyzers. Proc. of the European Symposium on Programming (ESOP), 2005. J. Feret. Static analysis of digital filters. Proc. of 30th ESOP Conference, 2004.

11 Generating Program Analyzers Program Analyzer Generator PAG: generates efficient data flow analyzers from concise mathematical specification. Binary-level analyzers: variety of processors to be supported. executable or assembly exec2crl CFG in CRL Instruction set / processor specification: formats, instruction classes, name space definitions (NET) analysis 1 analysis 2 analysis 3... Analysis specification - Domains - Transfer functions - Join functions - Interface PAG Program Analyzer Generator C code

12 Model Validation Especially important for WCET analysis: analyzer operates on processor model. It has to be shown that model conservatively approximates behavior of physical processor. Basic validation: compare analytically computed WCET bounds T A for code snippets or representative programs with measured times T M. T A >= T M must always hold. Local underestimations might be shadowed by overestimations in other parts, therefore additional validation required. In-depth validation: ait result includes prediction of all possible execution paths with all potential hardware states. Different hardware states correspond to different observable events. All observed events must be predicted by model.

13 Observable Events: Model Validation (2) Performance monitoring: clock ticks, cache misses, dispatched instructions, mispredicted branches Bus traces: requests generated by the core illustrate branch prediction behavior and other advanced pipeline features. Instruction traces (e.g. NEXUS): every instruction emits an event at beginning and end of its execution. Prediction graph: ait model can be configured to emit abstract traces for all these event types. Prediction graph is sound overapproximation of all possible traces of events observable in reality. Any measured event trace has to be part of prediction graph.

14 Automatic Trace Validation Measure execution behavior on physical hardware and create traces Determine prediction graph from ait analysis Check whether measured event trace is contained in prediction graph Validation successful iff there is path in prediction graph covering all events in exactly the same order in which they have been observed. Architecture Application Type Binary Size Event Types Trace Lines M68020 Avionics 14 MB bus 4.232.000 MPC 5xx Avionics 3 MB instruction 3.879.000 MPC 755 Avionics 120 MB bus 9.468.000 ait trace validation data for exemplary architectures

15 Qualification Support Kits Goal: demonstrate that the tool works correctly in the operational context of the user. 1. Report Package Tool Operational Requirements (TOR) Low-level requirements to tool behavior under normal operating conditions. Tool operational context, conditions for obtaining valid results, tool restrictions Verification Test Plan (VTP) Defines test cases for demonstrating all requirements specified in the TOR, including test setup, and structural and functional description of each test case. 2. Test Package Extensible set of test cases, including all test cases specified in the VTP. GUI providing convenient access to analyzer results and support for fully automatic execution and evaluation of all test cases. Result of tool qualification run can be stored together with other certification documents.

Qualification Support Kits 16

17 Qualification Software Life Cycle Data Goal: demonstrate that tool development process fulfills safety demands, e.g., regarding quality assurance, traceability, requirements engineering and verification activities. Document structure meets requirements of the DO-178B standard, but is applicable to other safety standards, as well. Available documents: Software Development Plan (SDP) Software Configuration Management Plan (SCMP) Software Quality Assurance Plan (SQAP) Software Verification Plan (SVP) Software Verification Results (SVR) Compliance Certificate (CC)

18 Conclusion Current safety standards require to demonstrate that the software works correctly and the relevant safety goals are met, including nonfunctional program properties. In all of them, variants of static analysis are recommended or highly recommended as a verification technique. Abstract Interpretation is formal method for statically verifying dynamic program properties. It defines the state of the art for validating non-functional software properties: WCET, stack usage, absence of runtime errors. Confidence in correctness of analysis results: Rigorous mathematical analysis theory Soundness proofs of individual analysis specification Automatic generation of analyzer implementation Model validation, e.g., by automatic trace validation Qualification Support Kits: tool operational requirements satisfied in operational context of tool user Qualification Software Life Cycle Data: demonstrate that tool development process is compliant to safety requirements

19 email: info@absint.com http://www.absint.com