• No results found

via static analysis and model checking

N/A
N/A
Protected

Academic year: 2021

Share "via static analysis and model checking"

Copied!
1
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

via static analysis and model checking

Future-based Analysis of Message Passing Programs

Wytse Oortwijn, Stefan Blom, and Marieke Huisman

Formal Methods and Tools - Department of Computer Science - University of Twente

CHALLENGE MOTIVATION CONTRIBUTION

Statically proving functional correctness

of message passing progams is very hard... ...but having the ability to proof their

correctness is crucial.... ...we propose future-based analysis to verify the communicational aspects.

Message exchanges are often concur- rent, the number of proceses are often unknown, and the number of possible behaviours is often infinite.

Classical examples of software faults in- clude the $400 million Pentium bug and the THERAC-25, which caused fatal inju- ries to numerous people.

We use separation logic to show local correctness and capture communicati- cal behaviour in abstract models, called futures, which we analyze to also proof global and functional correctness.

JAVA

mCRL2

input

ANNOTATED JAVA PROGRAM

FUTURE SPECIFICATION

STATIC

VERIFICATION

ENHANCING THE FUTURE

MODEL CHECKING

Java code annotated in JML fashion

Adding the abstract future

With the VerCors toolset

Global system model with safety and liveness properties

With the mCRL2 toolset

FUTUREJAVA

>_

FINAL VERDICT

Either pass or fail

+

OUTPUT TRANSFORMATION

Projection of results onto program code

1 2

7

3

6 5

4

1 Adding a future specification

As input we consider Java MPJ programs, annotated with per- mission-based separation logic. In addition, we specify a future that predicts the communication behaviour of the program.

2 Static verification with VerCors

Future annotations are added to the program annotations to specify the correspondence between futures and the program code. To illustrate, an annotated example program is given below.

3 Transforming the future

If a correspondence can be proven with VerCors, the futures are transformed into input for mCRL2, otherwise a fail verdict is reported.

4 Adding the semantics of MPI

In addition, the futures are combined with an mCRL2 process that describes the semantics of MPI.

6 Projecting model checking results

The output of mCRL2 is projected onto the source code, so that violations found after analyzing the futures can be linked to the corresponding function calls in the program code that caused the violation.

7 Final verdict

The VerCors toolset either successfully verifies the program with the given future specification, or indicates a violation and gives a report.

5 Transforming model checking results

The output of mCRL2 is analyzed and transformed to allow its projection onto the concrete source code.

Example program

An example with 1 server and N clients. Each client sends an in- teger to the server. The server sums up and broadcasts all re- ceived integers. Annotated pseudocode is given below:

Example future specification

The future annotations, which are mCRL2 process terms, de- scribe the communication behaviour. For every MPI function we define corresponding actions. For example, for MPI_Send, MPI_Recv, and MPI_Bcast we may define:

These actions are used in futures to specify the communica- tion behaviour. For example, the following two processes cor- respond to the example program:

With these futures we predict that clients send their integer v to the server and receive a value x, and that the server receives N values and broadcasts the sum of all values . The futures are analyzed to prove functional and communication correctness.

Static verification + model checking

The VerCors toolset is used to find a correspondence between futures and program code via Hoare logic reasoning. By prov- ing properties over futures we prove equivalent properties over the actual program. For example, we may use the follow- ing Hoare triple axioms:

Afterwards, we use the mCRL2 toolset to analyze the fu- tures, combined with a Network process that models the se- mantics of MPI. To illustrate, we may analyze:

With mCRL2 we check for communication correctness, e.g.

validity of message exchanges, resource leakage, and other in- teresting safety and liveness properties.

JAVA JAVA

FUTURE

+

Initially, the server starts as server(0,0) and each client i as client(vi). The program code is annotated with permis- sion-based separation logic and futures.

requires 0 ≤ n ≤ N

requires Future(Server(n,t)·F) ensures Future(F)

def server(int n, int t):

int N ← MPI_Size() if (n < N) then

int x MPI_Recv(*) server(n+1, t+x)

else MPI_Bcast(i, t) process Server(int n, int t) ≡ (n < N) → sum x:msg · recv(*, x) · Server(n+1, t+x) <> bcast(t);

action send, recv : rank × msg

action bcast : msg [send] {send(i,j,m)·F}MPI_Send(i,j,m){F}

{recv(i,j,m)·F}m MPI_Recv(i,j){F}

[recv]

{bcast(i,m)·F}MPI_Bcast(i,m){F}

[bcast]

Server || (Client || ··· || N times Client

{

) || Network requires Future(Client(v)·F)

ensures Future(F) def client(int v):

int i ← MPI_Rank() MPI_Send(0, v)

int sum ← MPI_Recv(0)

process Client(int v) ≡ send(0, v) · sum x:msg · recv(0, x);

w.h.m.oortwijn@utwente.nl

http://fmt.cs.utwente.nl/research

Referenties

GERELATEERDE DOCUMENTEN

Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of

• A submitted manuscript is the version of the article upon submission and before peer-review. There can be important differences between the submitted version and the

The RCCS, in this concept, is represented by a number of axially symmetrical elements: the reactor core, reactor pressure vessel, air in the cavity between

Om deze geo-infor- matie te beschrijven wordt gebruik gemaakt van een door Alterra ontwikkelt concept, GOBLET (Geo-Object-Basiseen- heid Locatie, Eigenschappen &amp; Tijd)..

Hypertension improvement project that also showed a gradual trend in the BP control.(12) Furthermore, an audit conducted in the Western Cape on hypertension suggested

When it is not we check if #1 is present in the list of files to be processed. If not we add it and initialize list of output files for that input and list of output files that

This study is part of a larger pragmatic cluster randomised controlled trial, which evaluated the effectiveness of the group diabetes education programme delivered by

To quantify the uncertainty between the se- lected roughness predictors, we selected the Van Rijn, Vanoni-Hwang, Engelund, 1977, Haque- Mahmood and Wright-Parker roughness predic-