• No results found

Runtime Verification for Real-Time Automotive Embedded Software

N/A
N/A
Protected

Academic year: 2021

Share "Runtime Verification for Real-Time Automotive Embedded Software"

Copied!
25
0
0

Loading.... (view fulltext now)

Full text

(1)

Runtime Verification for Real-Time Automotive

Embedded Software

S. Cotard, S. Faucou, J.-L. B´echennec, A. Queudet, Y. Trinquet

(2)

Motivating example

T0 T1 T2 b0 b1 s00 r10 r20 s11 r21

Safety constraint: T2 requires the data from b1, but also reads b0

in order to perform a plausibility check. T2 has to read the same

instance of data.

Requirement: consistency checking

Correctness property: when T2 starts reading, the buffers are

synchronized and stay synchronized until T2 completes its

(3)

A possible solution: diversification

T0 T1 T2 b0 b1 s00 r10 r20 s11 r21 Design and implementation 011001101

(4)

A possible solution: diversification

T0 T1 T2 b0 b1 s00 r10 r20 s11 r21 Design and implementation 011001101 Errors

(5)

A possible solution: diversification

T0 T1 T2 b0 b1 s00 r10 r20 s11 r21 Design and implementation 011001101 Errors

Monitoring and recovery

(6)

A possible solution: diversification

T0 T1 T2 b0 b1 s00 r10 r20 s11 r21 Design and implementation 011001101 Errors

Monitoringand recovery

(7)

Context

Objectives

based on formal methods

compatible with functional and industrial constraints

small and deterministic detection latency

small and deterministic overheads (execution time, memory footprint)

compatible with multi-tiers system design process (the provided source code is not always modifiable)

Proposed solution

runtime verification

(8)

Formal methods

Model M of a system S A B C ev1 ev2 ev3 ev4 Property

φ

Model checking: all runs of M satisfy φ ? (design time)

Tests: some runs of S satisfyφ ? (design time)

Runtime verification: does this run satisfyφ ? (online analysis)

−→ generate a monitor from M and φ that outputs a verdict in{>, ⊥, ?}

(9)

Our approach: runtime verification: step 1

[Bauer et al, 2011 ] solution

φ φ ¬φ A¬φ F¬φ ˆ A¬φ ˜ A¬φ A˜φ ˆ Aφ Fφ Aφ Mm Input : LTL property LTL property Non deterministic Buchï automata Emptiness checking (per state) Non deterministic Finite Automata Deterministic Finite Automata Output : Monitor Finite State Machine

For φ and¬φ 1) Compute NBAs

2) Emptiness checking per state (derived F)

3) Compute NFAs using F 4) Compute DFAs

(10)

Our approach: runtime verification: step1

Property

φ = G ((m t2.firstb0 ∨ m t2.firstb1) =⇒ (m sync.sync U m t2.begin))

1) Computation of the NBAs

Aφ S0 S1 m t2.begin m sync.sync m t2.begin m sync.sync A¬φ S00 S10 S20 true ¬m t2.begin ¬m t2.begin ¬m t2.begin ∧¬m sync.sync ¬m t2.begin ∧¬m sync.sync true

(11)

Our approach: runtime verification: step1

Property

φ = G ((m t2.firstb0 ∨ m t2.firstb1) =⇒ (m sync.sync U m t2.begin))

1) Computation of the NBAs

Aφ S0 S1 m t2.begin m sync.sync m t2.begin m sync.sync A¬φ S00 S10 S20 true ¬m t2.begin ¬m t2.begin ¬m t2.begin ∧¬m sync.sync ¬m t2.begin ∧¬m sync.sync true

2) Emptiness checking per state

Fφ={S0, S1} F¬φ={S 0 0, S 0 1, S 0 2}

(12)

Our approach: runtime verification: step1

Property

φ = G ((m t2.firstb0 ∨ m t2.firstb1) =⇒ (m sync.sync U m t2.begin))

3) Computing NFAs using F andcompletes automata

ˆ Aφ S0 S1 S2 m t2.begin m sync.sync m t2.begin m sync.sync ¬m t2.begin ∧¬m sync.sync ¬m t2.begin ∧¬m sync.sync true ˆ A¬φ S00 S10 S20 S30 true ¬m t2.begin ¬m t2.begin ¬m t2.begin ∧¬m sync.sync ¬m t2.begin ∧¬m sync.sync true m t2.begin true

(13)

Our approach: runtime verification: step1

Property

φ = G ((m t2.firstb0 ∨ m t2.firstb1) =⇒ (m sync.sync U m t2.begin))

4) Determinization−→ Composition −→ Minimization

init bad St2 m t2.begin ¬m t2.begin ∧ m sync.sync m t2.begin ¬m t2.begin ∧ m sync.sync ¬m t2.begin ∧ ¬m sync.sync ¬m t2.begin ∧ ¬m sync.sync true

The intermediate monitor Mm reacts to changes in the values of

(14)

Our approach: runtime verification: step1

Intermediate monitor (Mm)

The intermediate monitor is the Moore machine given by Mm= (Qm, im,

m, γm) over 2AP, the set of intercepted events

Qm is the finite set of states im is the initial state

→m⊂ (Qm× 2AP)7→ Qm is the transition function

γm⊂ Qm7→ B

(15)

Our approach: runtime verification: step2

Input: system model + properties

sync nosync inprog s11, r10 s00 s00, s11 r10 s00 s11 m sync: buffers synchronization begin firstb0 firstb1 r20 r21 r21 r20 m t2: T 2 behavior

G ((m t2.firstb0∨ m t2.firstb1) =⇒ (m sync.sync U m t2.begin))

T0 T1 T2 b0 b1 s00 r10 r20 s11 r21

(16)

Our approach: runtime verification: step2

Model of the system (As)

The model of the system is given by As = (Qs, is,

s) over Σs,

the set of intercepted events

Qs is the finite set of states is ∈ Qs is the initial state

→s⊂ (Qs× Σs)7→ Qs is the transition function

We denoteλs ⊂ Qs 7→ 2AP, the labeling function that maps each

(17)

Our approach: runtime verification: step2

Final monitor computation (M0)

The final monitor is defined by M0 = (Q0, i0,→, γ0) over Σs

Q0= Qs× Qm i0= (is, im) →⊂ (Q0× Σs)7→ Q0 where (qs, qm)→ (rσ s, rm) iff qs σ srs and qm u→mrm and u ⊆ λs(rs) andγm(qm) =? γ0⊂ Q0 7→ B3 whereγ0(qs, qm) =γm(qm)

(18)

Our approach: runtime verification: step2

Output: a monitor ? ? ? ? ? ⊥ s11, r10 s00 r20 r21 s00, r20 s11, r10 r21 s00, r21 s11, r10 r20 r20, r21, r10 s11 s00 s11, s00 r10 r20, r21

(19)

Enforcer : A tool for monitor synthesis

Enforcer tool System model (transition system) Properties (LTL formulae)

ltl_rule = "Always (a Until b)"

Output sources Monitor (*.c *.h) (Transition table) Inconclusive state True state False state M� ltl rule As *.enf file

LTL→ NBA → Intermediate Moore machine

| {z }

step 1

→ Monitor | {z }

(20)

Injection of the monitors in the kernel

The Trampoline compilation chain (open-source implementation of AUTOSAR OS)

*.oil

*.enf

*.c *.h 01100101

RTOS and application sources

System configuration application configuration

sources monitor description monitor sources Enforcer Binary Code *.c *.h *.c *.h

(21)

Architecture

T0 T1 T2 b0 b1 Monitoring service s00 r10 s11 r21 r21 false true Event

table HandlerEvent Monitorupdate Transitiontable Monitor update

Event analysis

(22)

Evaluation: computation overhead

Execution time (µs)

0 10 20 30

SendMessage SendMessage with ActivateTask SendMessage with SetEvent ReceiveMessage Monitoring of 1 monitor 15.4 24 18.5 10 3.4 target running at 60 MHz composition of the overhead

1µs to identify the event

(23)

Evaluation: memory footprint

Transition table Monitor descriptor Code size

ROM RAM ROM/RAM

30 bytes 15 bytes

152 bytes (monitor update)

constant depends on the monitor constant per monitor 16 bytes (event handler)

3 optimizations depends on the number

(24)

Conclusion

approach has been implemented in a tool: Enforcer

freely available (see paper for URL)

results show that runtime verification can be affordable for (static) industrial real-time embedded systems

kernel instrumention allows to achieve (guaranteed) low detection latency

static code and data generation allows to achieve low execution time overhead

system designer can pay time for memory

future works

compute the theoretical bound on the size of the monitors (given the size of M andφ)

(25)

References

Related documents

However, when initial levels of binge eating symptoms were not included in the model, the results were consistent with our hypothesis in that high perfectionism, high

Dr Srivastava: Intravitreal sirolimus 440 µg is being developed as a local treatment for noninfectious uveitis involving the posterior segment.. It is a mammalian target of

Tujuan dari penelitian ini adalah menjelaskan dan menganalisis proses pembentukan kata dari kata benda dalam sebuah novel yang berjudul “ A Child Called It” karya

Panel B of Table 3 shows the differences between full- and part-time fac- ulty members’ levels of satisfaction according to a global indicator, “overall satisfaction with the job.”

Na tentativa de conservar o maior número de plantas com importância forrageira respeitando a forma de manejo utilizada pelos produtores rurais da região do Alto Camaquã, foi

For which kind of software architecture for embedded systems is the worst response time for task code the execution time for the longest task code plus the execution time for

independent variables of eligibility status (DD eligible and noneligible), ethnicity (Black, White, Hispanic), and placement setting prior to testing (home, daycare, public

We also found that up to 67% of sites with an extant amino acid state were influ- enced by sign epistasis, resulting in a rugged fitness landscape and a limited number of fitness