Runtime Verification (RV) Usa Sammapun University of Pennsylvania September 29, 2004.

Slides:



Advertisements
Similar presentations
1 Verification by Model Checking. 2 Part 1 : Motivation.
Advertisements

Auto-Generation of Test Cases for Infinite States Reactive Systems Based on Symbolic Execution and Formula Rewriting Donghuo Chen School of Computer Science.
MaC Monitoring and Checking at Runtime (Continue) Presented By Usa Sammapun CIS 700 Oct 12, 2005.
Reliable Scripting Using Push Logic Push Logic David Greaves, Daniel Gordon University of Cambridge Computer Laboratory Reliable Scripting.
A Survey of Runtime Verification Jonathan Amir 2004.
CS 267: Automated Verification Lecture 2: Linear vs. Branching time. Temporal Logics: CTL, CTL*. CTL model checking algorithm. Counter-example generation.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
Algorithmic Software Verification VII. Computation tree logic and bisimulations.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Runtime Verification Ali Akkaya Boğaziçi University.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
RV: A Runtime Verification Framework for Monitoring, Prediction and Mining Patrick Meredith Grigore Rosu University of Illinois at Urbana-Champaign (UIUC)
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
CS6133 Software Specification and Verification
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
UPPAAL Introduction Chien-Liang Chen.
ECE 720T5 Fall 2012 Cyber-Physical Systems Rodolfo Pellizzoni.
/ PSWLAB Efficient Decentralized Monitoring of Safety in Distributed System K Sen, A Vardhan, G Agha, G Rosu 20 th July 2007 Presented by.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
MaC Monitoring and Checking at Runtime Presented By Usa Sammapun CIS 700 Oct 10, 2005.
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
More Enforceable Security Policies Lujo Bauer, Jay Ligatti and David Walker Princeton University (graciously presented by Iliano Cervesato)
System Design Research Laboratory Model-based Testing and Monitoring for Hybrid Embedded Systems Li Tan Jesung Kim Oleg Sokolsky Insup Lee University of.
Automata and Formal Lanugages Büchi Automata and Model Checking Ralf Möller based on slides by Chang-Beom Choi Provable Software Lab, KAIST.
VESTA: A Statistical Model- checker and Analyzer for Probabilistic Systems Authors: Koushik Sen Mahesh Viswanathan Gul Agha University of Illinois at Urbana-Champaign.
System Design Research Laboratory Specification-based Testing with Linear Temporal Logic Li Tan Oleg Sokolsky Insup Lee University of Pennsylvania.
Testing and Monitoring at Penn An Integrated Framework for Validating Model-based Embedded Software Li Tan University of Pennsylvania September, 2003.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Flavio Lerda 1 LTL Model Checking Flavio Lerda. 2 LTL Model Checking LTL –Subset of CTL* of the form: A f where f is a path formula LTL model checking.
Verification technique on SA applications using Incremental Model Checking 컴퓨터학과 신영주.
11/9/041 Bridging the gap between specification and implementation Insup Lee Department of Computer and Information Science University of Pennsylvania.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
The Architecture of Secure Systems Jim Alves-Foss Laboratory for Applied Logic Department of Computer Science University of Idaho By, Nagaashwini Katta.
Static and Dynamic Analysis at JPL Klaus Havelund.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Survey on Trace Analyzer (2) Hong, Shin /34Survey on Trace Analyzer (2) KAIST.
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
5/27/03MDES Supporting Model-Based Validation at Run-time Insup Lee and Oleg Sokolsky Department of Computer and Information Science University of.
On Reducing the Global State Graph for Verification of Distributed Computations Vijay K. Garg, Arindam Chakraborty Parallel and Distributed Systems Laboratory.
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
Dynamic Program Analysis Klaus Havelund Kestrel Technology NASA Ames Research Center Motivation for writing specs: Instant gratification.
2015 Concurrency: logical properties 1 ©Magee/Kramer 2 nd Edition Chapter 14 Logical Properties Satisfied? Not satisfied?
Verification & Validation By: Amir Masoud Gharehbaghi
Constraints Assisted Modeling and Validation Presented in CS294-5 (Spring 2007) Thomas Huining Feng Based on: [1]Constraints Assisted Modeling and Validation.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Parallel and Distributed Systems Laboratory Paradise: A Toolkit for Building Reliable Concurrent Systems Trace Verification for Parallel Systems Vijay.
Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
ICDCS 2006 Efficient Incremental Optimal Chain Partition of Distributed Program Traces Selma Ikiz Vijay K. Garg Parallel and Distributed Systems Laboratory.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
1 Jay Ligatti (Princeton University); joint work with: Lujo Bauer (Carnegie Mellon University), David Walker (Princeton University) Enforcing Non-safety.
Formal methods: Lecture
Timed Safety Property Runtime Enforcement Wanjiang Qian 03/22/2016.
ONR MURI area: High Confidence Real-Time Misuse and Anomaly Detection
Formally Specified Monitoring of Temporal Properties
runtime verification Brief Overview Grigore Rosu
Efficient Decentralized Monitoring of Safety in Distributed Systems
Koushik Sen Abhay Vardhan Gul Agha Grigore Rosu
Monitoring Programs using Rewriting
CSCI1600: Embedded and Real Time Software
Generating Optimal Linear Temporal Logic Monitors by Coinduction
Program Monitoring with LTL in EAGLE
CSCI1600: Embedded and Real Time Software
Dichotomies in CSP Karl Lieberherr inspired by the paper:
Runtime Safety Analysis of Multithreaded Programs
Presentation transcript:

Runtime Verification (RV) Usa Sammapun University of Pennsylvania September 29, 2004

Introduction Modeling language: CCS, CSP, Kripke Verification: Model Checking Language: Java, C, C++, etc.. Verification: Formal Test Generation Language: CTL

Introduction Modeling language: CCS, CSP, Kripke Verification: Model Checking Language: Java, C, C++, etc.. Verification: Formal Test Generation Runtime Verification Language: CTL

Motivation Limitation of current verification techniques Model checking Testing

Model Checking Pro Formal Complete – Provides guarantees Con Doesn’t scale well Checks design, not implementation

Testing Pro Scales well Tests an implementation directly Con Informal Incomplete – Doesn’t provide guarantees.

How does RV verify? 1. Specify formal requirements 2. Extract information from current executing program 3. Check the execution against formal requirements

Runtime Verification ProgramVerifier Execution Information Check Sat / Unsat Feedback User

Runtime Verification Formal Done at implementation Not complete Guarantee for current execution

JPaX: Java PathExplorer Klaus Havelund Grigore Rosu (NASA) [HR01, HR04]

JPaX Checks the execution of Java program During program testing to gain info about execution During operation to survey safety critical systems Extracts interesting events from an executing program Checks those events Logic based monitoring Error pattern analysis Deadlock Data race

JPaX Java ProgramJPaX Verifier Execution Information Check Sat / Unsat User

JPaX Verifier Instrumentation (Extracting Info) Observer (Checking) Inter connection

Instrumentation Module: How JPaX extracts info Given Java bytecode Instrumentation specification To extract Examine java bytecode Insert some code at places specified instrumentation specification Logic based / error pattern analysis Send this info to the observer

Insert Code: Logic Based class C { int x; main() { x = -1; x = -2; x = 1; x = -3; } instrumentation: monitor C.x; proposition A is C.x > 0 class C { int x; main() { x = -1; send(x,-1); x = -2; send(x,-2); x = 1; send(x,1); x = -3; send(x,-3); } + = Sent to observer: [ (x,-1), (x,-2), (x,1), (x,-3) ]

Not all info is needed instrumentation: monitor C.x; proposition A is C.x > 0 Sent to observer: [ (A,false), A, A ] class C { int x; main() { x = -1; eval(x,-1); x = -2; eval(x,-2); x = 1; eval(x,1); x = -3; eval(x,-3); } X = -1X = 1X = -2X = -3 A Send(A,false)Send(A) true false

Not all info is needed What eval(x,value) does Look at all propositions P corresponding to variable x Evaluate the value of P (true, false) Using value of x If P has no value, Send event (P, P_val) to observer Else If P changes value, Send (P) to observer

Insert Code: Error Pattern Instead of sending propositions to the observer Sends events Acquiring locks (deadlock, data race) Releasing locks (deadlock, data race) Accessing variables (data race)

Interconnection Module Send extracted info From the java program to the observer Via socket, shared memory, file Extraced Info Event stream

Event Stream Similar to Kripke structure Kripke Event Stream (Trace) N 1,N 2 T 1,N 2 N 1,T 2 !AA [ (A,false), A, A ]

Observer Module Runs in parallel with the Java program Monitors and analyzes 2 Components Logic based monitoring Error Pattern Analysis Deadlock Data race

1. Logic Based Monitoring Given Trace (Event stream) Specification in some logic To check Check if properties in specification hold in the trace

Logic Based Monitoring Logic CTL – Model checking AG, EG, AF, EF, AX, EX, AU, EU Tree like Not appropriate for event stream Only has one path P PP AG P

LTL LTL – Linear Temporal Logic G, F, X, U (□, ◇, ○, U) Linear instrumentation: monitor C.x; proposition A is C.x > 0 verification: formula F1 is <> A PPP G P

Past Time LTL (ptLTL) More natural for RV ʘ F – previous F (as oppose to next) ▣ F – always F in the past ◈ F – eventually F in the past F 1 S F 2 – F 1 since F 2 [F 1, F 2 ) – interval F 1, F 2 F2F2 F1F1 F1F1 F1F1 F 1 S F 2 F1F1 F2F2 [F 1,F 2 )

JPaX Checking Given Trace LTL or ptLTL Check Use “Maude engine” to check Or dynamic programming Result True or false We want it to always return true The requirement is satisfied Nothing bad has happened

Maude Rewriting engine Treat LTL or ptLTL as an equation “Rewrite” or “consume” this LTL/ptLTL equation and produce a new equation A new equation – a new state Normal form (true or false) Just another LTL or ptLTL

Rewrite LTL ** propositional logic ** eq true /\ X = X eq false /\ X = false eq true \/ X = true eq false \/ X = X eq X /\ (Y \/ Z) = (X /\ Y) \/ (X /\ Z) Eq (X /\ Y){As} = X{As} /\ Y{As} Eq (X \/ Y){As} = X{As} \/ Y{As} ** LTL ** eq ([] X){As} = ([] X) /\ X{As} eq (<> X){As} = (<> X) \/ X{As} eq (o X){As} = X eq (X U Y){As} = Y{As} \/ ( X{As} /\ (X U Y) ) X{As} = assignment of a boolean value to a variable X

Example instrumentation: monitor C.x; proposition A is C.x > 0 verification: formula F1 is <> A Here A is false eq (<> A){As} = (<> A) \/ A{As} = (<> A) \/ false = (<> A) !A A Here A is true eq (<> A){As} = (<> A) \/ A{As} = (<> A) \/ true = true Here A is false eq true

Dynamic Programming ptLTL For each formula P Divide P into subformulae Keep the value of each proposition and subformulae from the previous state (pre[ ]) Calculate the value of each subformulae for current state (now[ ]) by using pre[ ] and now[ ]

Dynamic Programming Propositional logic now[x \/ y] = now[x] \/ now[y] now[x /\ y] = now[x] /\ now[y] now[ !x ] = ! now[x] ptLTL now[ (.) x] = pre[x] now[ [.] x] = pre[ [.] x] /\ now[x] now[ x ] = pre [ x] \/ now[x] now[ x S y] = now[y] \/ now[ [(.) y, !x) ] now[ [x,y) ] = (pre[ [x,y) ] \/ now[x]) /\ !now[y]

Example: x ∧ [y, z) bit pre[0..4] bit now[0..4] INPUT: trace t = e 1 e 2 e 3...e n ; Subformulae: 0: x /\ [y, z) 1: x 2: [y, z) 3: y 4: z Init: pre[4] = z(state); pre[3] = y(state); pre[2] = pre[3] and not pre[4]; pre[1] = x(state); pre[0] = pre[1] and pre[2]; for i = 2 to n do { state = update(state,e i ); now[4] = z(state); now[3] = y(state); now[2] = (pre[2] or now[3]) and not now[4]; now[1] = x(state); now[0] = now[1] and now[2]; if now[0] = 0 then output(‘property violate’); pre = now; }

Running Time At one point O (m) m = size of formula Overall O (n m) n = number of events m = size of formula

2. Error Pattern Analysis Use well-known algorithm to detect Data race Deadlock

Data Race – Cause Cause Two or more concurrent threads Access a shared variable At least one access is write No explicit critical section mechanism Init x = 0; T1: x = x+1; T2: x = x+10; x=0 T1 reads x=1 T1 writes x=1 T2 reads x=11 T2 writes x=0 T1 reads x=0 T2 reads x=1 T1 writes x=10 T2 writes

Data Race – Check Events Acquiring, releasing locks Shared variable accessing Checks – make sure that The lock is held by any thread whenever it accesses the variable

Deadlock – Cause Order of acquiring and releasing locks T1: Get lock1 Get lock2 Release lock2 Release lock1 T2: Get lock2 Get lock1 Release lock1 Release lock2

Deadlock – Check Events Acquiring, releasing locks Checks Thread map – keep track of locks owned by each thread Lock graph – edge record locking orders Introduce from a lock to another lock each time when a thread that already owns the first lock acquires the other If lock graph is cyclic, deadlock potential

That’s it for JPaX Specification Logic LTL Information Extraction Instrument bytecode Events Propositions Get/Release locks, variable access Check Rewriting engine Dynamic programming Error pattern analysis

Other RV tools Different Logic LTL Timed LTL [TR04] F 1 U < t F 2 (Extended) Regular Expression [CR03] Interval logic Automata [LBW03]

Extracting Information From bytecode Instrument bytecode [HR01, HR04, KKL+04] Code, specification in different files Normal compiler From sourcecode Instrument source code Code, specification in different files Normal compiler Specification embedded in source code [LBW03, Dru03] Special compiler translates specification into some code Use debugger [BM02] Does not modify program code Configure the debugger to generate events at desirable points in the code

Checker Rewriting engine Maude Dynamic programming Translate LTL to Automata [CR03] States – states in a trace Transitions – inputs are events Accepting states – satisfied

Same technique, different purpose Security Check security policy Edit automata Model-carrying code Intrusion detection

Edit Automata [ LBW03 ] How can we run untrusted code on our machine? Use monitor, called ‘edit automata’ Analogous to the JPaX observer ‘edit automata’ monitors and enforces security policies Analogous to the JPaX specification

Edit Automata ProgramEdit Automata Execution Information Check Enforcing Security Policy User

Edit Automata Specification Logic (Security policy) Automata Information Extraction Embedded in source code Events Actions (Method calls) Check Automata

Enforcing Policy When it recognizes a dangerous operation, it may halt the application suppress (skip) the operation but allow the application to continue insert (perform) some computation on behalf of the application This slide is taken from David Walker

Security Policy Automata app’s action allowed, edited action

Example Program: Cable car Policy: Showing ticket policy insert

Model-Carrying Code [ SVB+03 ] How can we run untrusted code on our machine? Untrusted code comes with a model of its security-relevant behavior Users have their own security policies

Two checking Does untrusted program’s model respect user’s security policy? Use model checking to check Security policy is a specification Does model capture program behavior? Use runtime checking Model is a specification (Automata) Events are system calls

Intrusion Detection 2 Approaches for ID Anomaly-based Behavior deviates from normal behavior is an intrusion Signature-based Define patterns of bad behaviors or attacks Anything fits the patterns is an intrusion

Intrusion Detection using RV [ NST04 ] Signature-based Use LTL to define attack pattern Use runtime verification Runs in parallel Observes behaviors of programs Check if behaviors match LTL attack pattern If so, raises an alarm

Conclusion Lightweight Verification alternative to model checking and testing Formal Done at Implementation Security Development Multithreaded [SRA03] Distributed [SVAR04] Probabilistic

References - RV [HR04] Klaus Havelund and Grigore Rosu. An Overview of the Runtime Verification Tool Java PathExplorer. Journal of Formal Methods in System Design, 24(2): , [HR01] Klaus Havelund and Grigore Rosu. Java PathExplorer - A runtime verification tool. In Proceedings of the 6th International Symposium on Artificial Intelligence, Robotics and Automation in Space, (ISAIRAS'01), Montreal, Canada, Jun [TR04] Prasanna Thati and Grigore Rosu. Monitoring Algorithms for Metric Temporal Logic Specifications. In Proceedings of the 4nd International Workshop on Run-time Verification, Apr [CR03] Feng Chen and Grigore Rosu. Towards Monitoring-Oriented Programming: A Paradigm Combining Specification and Implementation. In Oleg Sokolsky and Mahesh Viswanathan, editors, Electronic Notes in Theoretical Computer Science, volume 89. Elsevier, [BM02] Mark Brörkens and Michael Möller. Dynamic Event Generation for Runtime Checking using the JDI. In Klaus Havelund and Grigore Rosu, editors, Electronic Notes in Theoretical Computer Science, volume 70. Elsevier, 2002.

References - RV [KKL+04] Moonjoo Kim, Sampath Kannan, Insup Lee, Oleg Sokolsky, and Mahesh Viswanathan. Java-MaC: a Run-time Assurance Approach for Java Programs. Formal Methods in Systems Design, 24(2): , Mar [Dru03] Doron Drusinsky. Monitoring Temporal Rules Combined with Time Series. In Proceedings of the 2003 Computer Aided Verification Conference (CAV), volume 2725, pages Springer-Verlag, Jul [SRA03] Koushik Sen, Grigore Rosu, and Gul Agha. Runtime Safety Analysis of Multithreaded Programs. In Proceedings of the 10th European Software Engineering Conference and the 11th ACM SIGSOFT Symposium on the Foundations of Software Engineering, (FSE/ESEC 03), pages , Helsinki, Finland, Sep [SVAR04] Koushik Sen, Abhay Vardhan, Gul Agha, and Grigore Rosu. Efficient Decentralized Monitoring of Safety in Distributed Systems. In Proceedings of 26th International Conference on Software Engineering (ICSE 04), 2004.

References - Security [LBW03] Jay Ligatti, Lujo Bauer, and David Walker. Edit Automata: Enforcement Mechanisms for Run-time Security Policies. Technical report, Princeton University, Computer Science Department, May [SVB+03] R. Sekar, V.N. Venkatakrishnan, Samik Basu, Sandeep Bhatkar, and Daniel C. DuVarney. Model-Carrying Code: A Practical Approach for Safe Execution of Untrusted Applications. In Proceedings of the 19th ACM Symposium on Operating Systems Principles, pages , Bolton Landing, New York, Oct [NST04] Prasad Naldurg, Koushik Sen, Prasanna Thati. A Temporal Logic Based Approach to Intrusion Detection. In Proceedings of the International Conference on Formal Techniques for Networked and Distributed Systems (FORTE 2004), 2004.

The End