Verifying the CPA Networking Stack using SPIN/Promela Kevin - - PowerPoint PPT Presentation

verifying the cpa
SMART_READER_LITE
LIVE PREVIEW

Verifying the CPA Networking Stack using SPIN/Promela Kevin - - PowerPoint PPT Presentation

Verifying the CPA Networking Stack using SPIN/Promela Kevin Chalmers and Jon Kerridge Edinburgh Napier University Breakdown Introduction and Motivation CPA Networking Stack Architecture Operation SPIN Model of the CPA


slide-1
SLIDE 1

Verifying the CPA Networking Stack using SPIN/Promela

Kevin Chalmers and Jon Kerridge Edinburgh Napier University

slide-2
SLIDE 2

Breakdown

  • Introduction and Motivation
  • CPA Networking Stack
  • Architecture
  • Operation
  • SPIN Model of the CPA Networking
  • Processes
  • Architecture
  • Results
  • Conclusions and Future Work
slide-3
SLIDE 3

Motivation

  • CPA Networking Stack developed from JCSP

Networking

  • net2 package
  • Original JCSP Networking had poor error handling
  • Errors in the stack not sent to application layer
  • Verify CPA Networking Stack operates under certain

conditions

  • Bufferring
  • Network failure
slide-4
SLIDE 4

SPIN/Promela

  • SPIN (Simple Promela INterpreter) provides state space

checking

  • Assertion checking
  • Deadlock
  • Liveness
  • Language to build SPIN models is Promela (PROcess

MEta LAnguage)

  • Similar semantics to CSP
  • Components as processes
  • Processes communicate via channels
  • Choice between events
  • Provides channel mobility (CPA Networking Stack

currently relies on channel mobility internally)

slide-5
SLIDE 5

CPA Networking Stack

  • CPA Networking Stack developed from JCSP

Networking

  • Goal is to provide a method to allow multiple

platform / framework communication in a transparent CPA manner

  • Networked channels
  • Networked barriers
  • Development of standard components and protocol
  • Take two views
  • Layered architecture
  • High-level component architecture
slide-6
SLIDE 6

Layered Architecture

  • Application layer
  • User level processes
  • Event layer
  • Networked

synchronization primitives

  • Link layer
  • Connections to other

nodes

  • Communication layer
  • Underlying I/O

mechanism

Application E vent C

  • mmunication

Link

E vent Interfaces C hannel & Link C

  • nnection

C

  • nnection S

tream C

  • mmunication S

pecific Messaging Virtual Numbering Node Addressing C

  • mmunication S

pecific Addressing R untime Data Types C P A Networking Protocol R aw Data

slide-7
SLIDE 7

High Level Architecture

  • Link
  • LinkTx for outgoing

messages

  • LinkRx for incoming

messages – protocol implemented here

  • Networked channels
  • Output provides a writing

end

  • Input provides a reading

end

  • Other components for

management, barriers

Link Net Channel Input Net Channel Output LinkTx LinkRx Application Process Application Process

slide-8
SLIDE 8

Protocol

  • Message defined by a triple (with possible data

load)

  • (<type>, <attr1>, <attr2>, [<data>])
  • Basic channel messages
  • (SEND, <dest>, <source>, <data>)
  • (ACK, <dest>, null)
  • (REJECT_CHANNEL, <dest>, null)
  • (POISON, <dest>, <strength>)
  • (LINK_LOST, <null>, <null>)
  • (ASYNC_SEND, <dest>, <source>, <data>)
slide-9
SLIDE 9

SEND/ACK Operation

Application Process Net Channel Output (45) LinkTx LinkRx Net Channel Input (97) Application Process LinkTx LinkRx

  • 1. write
  • 2. SEND|97|45|[data]
  • 3. bytes
  • 4. SEND|97|45|[data]
  • 5. read
  • 6. [data]
  • 7. ACK|45|-1
  • 8. bytes
  • 9. ACK|45|-1
  • 10. end write
slide-10
SLIDE 10

SEND/REJECT Operation

Application Process Net Channel Output (45) LinkTx LinkRx LinkTx LinkRx

  • 1. write
  • 2. SEND|97|45|[data]
  • 3. bytes
  • 5. bytes
  • 6. REJECT_CHANNEL|45|-1
  • 7. exception
  • 4. REJECT_CHANNEL|45|-1
slide-11
SLIDE 11

SEND/LINK_LOST

  • One of the biggest issues in JCSP Networking
  • Link failure caused resources to remain and

messages to disappear

  • LINK_LOST message now informs all outgoing

channels of link failure

  • Two possibilities
  • Prior to a write, link goes down. SEND message

immediately replied with LINK_LOST

  • Mid-write link goes down. All output channels

connected to link are sent LINK_LOST

slide-12
SLIDE 12

Building a SPIN Model of CPA Networking

  • Only five messages of interest from protocol
  • ASYNC_SEND cannot be checked as sender waits for no

ACK – infinite state space

  • Promela uses mtype to define message types

mtype = { SEND , ACK , REJECT_CHANNEL , POISON , LINK_LOST };

slide-13
SLIDE 13

Channel States

  • INACTIVE
  • OK_INPUT
  • OK_OUTPUT
  • POISONED
  • DESTROYED
  • BROKEN

typedef CHANNEL_DATA { byte vcn ; byte state = INACTIVE ; chan toChannel ; };

INACTIVE OK_OUTPUT OK_INPUT BROKEN POISONED DESTROYED

create() create() POISON or poison() destroy() destroy() REJECT_CHANNEL or LINK_LOST POISON or poison()

slide-14
SLIDE 14

NetChannelOutput

  • Use channels to

simulate method calls

  • Three operations
  • Write
  • Poison
  • Destroy
  • NetChannelOutput

connected to a LinkTx

  • Incoming

acknowledgement channel

NetChannelOutput

write poison destroy callReturn toLinkTx ackChannel

slide-15
SLIDE 15

NetChannelInput

  • Five operations
  • Read
  • Start Read and End

Read

  • Extended rendezvous
  • Poison
  • Destroy
  • NetChannelInput has

an incoming channel for messages

NetChannelInput

read startRead endRead poison destroy callReturn fromLink

slide-16
SLIDE 16

Link Process

  • Link contains two sub-

processes

  • LinkTx
  • LinkRx – see paper for

full Promela code

  • Incoming link from

event processes

  • Connection to the

network

Link

toLinkTx toNetwork fromNetwork

slide-17
SLIDE 17

InputNode

InputNode Link NetChannelInput Receiver

slide-18
SLIDE 18

OutputNode

OutputNode Sender NetChannelOutput Link

slide-19
SLIDE 19

Network Process

  • Network process simply forward messages from

the InputNode to the OutputNode and vice-versa

  • To simulate failure, the Network process can non-

deterministically fail

  • See paper for Network process code
  • Sending and receiving modelled as atomic – the

underlying communication mechanism is assumed to deal with incomplete messages

  • Exceptional behaviour
slide-20
SLIDE 20

SPIN Model of CPA Networking

  • Model has one

OutputNode connected to one InputNode

  • The OutputNode can

have multiple output channels

  • InputNode channel has

a buffer

  • Discussed later
  • Flag used to determine

link failure

OutputNode Network InputNode

slide-21
SLIDE 21

Initial Findings

  • Single NetChannelOutput connected to a single

NetChannelInput with single space buffer successful

  • Basic assumption
  • Link informing NetChannelOutputs of link failure solves

link failure problems

  • Original JCSP Networking did not lock state of a

networked channel

  • Never experienced but would lead to a failed channel

being sent a message and no error raised

  • State of a channel is now locked – no race hazard!
slide-22
SLIDE 22

Verifying the Model - Assumptions

  • CPA Networking works on the premise that for

every connected network output to a network input, one space is required in the input channel buffer

  • For implementation purposes, a channel has an

“infinite” buffer

  • To check this, we need to examine the relationship

between the number of connected outputs to a network input and the buffer size

slide-23
SLIDE 23

Results

NUMBER_OUTPUTS 1 2 3 4 BUFFER_SIZE FAIL FAIL FAIL FAIL 1 𝟒. 𝟏𝟕 × 𝟐𝟏𝟔 𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟔𝟐 𝒆𝒇𝒒𝒖𝒊 FAIL FAIL FAIL 2 𝟑. 𝟖𝟗 × 𝟐𝟏𝟔𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟔𝟐 𝒆𝒇𝒒𝒖𝒊 𝟒. 𝟖𝟐 × 𝟐𝟏𝟖 𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟑𝟕𝟓 𝒆𝒇𝒒𝒖𝒊 FAIL FAIL 3 𝟑. 𝟖𝟗 × 𝟐𝟏𝟔𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟔𝟐 𝒆𝒇𝒒𝒖𝒊 𝟒. 𝟖𝟐 × 𝟐𝟏𝟖 𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟑𝟕𝟓 𝒆𝒇𝒒𝒖𝒊 PASS* FAIL 4 𝟑. 𝟖𝟗 × 𝟐𝟏𝟔𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟔𝟐 𝒆𝒇𝒒𝒖𝒊 𝟒. 𝟖𝟐 × 𝟐𝟏𝟖 𝒕𝒖𝒃𝒖𝒇𝒕 𝟒𝟑𝟕𝟓 𝒆𝒇𝒒𝒖𝒊 PASS* PASS*

slide-24
SLIDE 24

Conclusions

  • CPA Networking Stack is deadlock free even under

network failure

  • Removed the lack of state protection in the original

JCSP implementation

  • Buffer size has a relation to number of incoming

networked outputs

  • Infinite buffer should ensure deadlock freedom
slide-25
SLIDE 25

Future Work

  • Really need to show that the networked channel

behaves as a standard channel

  • Refinement check
  • SPIN doesn’t support refinement checks
  • Temporal logic capabilities
  • Simplify the model and check – but would remove most

behaviour

  • Current plan is to move to a networking stack that

can sit atop MPI

  • Reengineering and further verification would be

required

slide-26
SLIDE 26

Questions?