37
© 2017 Arm Limited How Can You Trust Formally Verified Software? Alastair Reid Arm Research @alastair_d_reid

How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

HowCanYouTrustFormallyVerified

Software?AlastairReid

ArmResearch@alastair_d_reid

Page 2: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited2

Bufferover-readvulnerabilities

Logicerrorvulnerabil

ities

Bufferover-readvulnerabilitiesNullpointerdereference

Useafterfree

Bufferoverflowvulnerabilities

Page 3: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited3

Formalverification

Oflibrariesandapps Ofcompilers Ofoperatingsystems

Page 4: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited4

FormallyVerifiedSoftware

VerificationTool

FormalSpecifications

ShimCode

Fonsecaetal.,AnEmpiricalStudyontheCorrectnessofFormallyVerifiedDistributedSystems,Eurosys‘17

Page 5: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited5

Takeaway#1:3keyquestionstoask

1. Whatspecificationsdoesyourproofrelyon?

2. Whydoyoutrustthosespecifications?

3. Doesanybodyelseusethesespecifications?

Page 6: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited6

Takeaway#2:Specificationsmusthavemultipleuses

Page 7: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited7

Takeaway#2:Specificationsmusthavemultipleuses

Page 8: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited8

Howcanyoutrustformallyverifiedsoftware?

Howcanyoutrustformallyverifiedsoftware?

SpecificationsarepartoftheTCB

3keyquestions

Specificationsmusthavemultipleusers

Howcanyoutrustformalspecifications?

Testingspecifications

Verifyingprocessors

Verifyingspecifications

Howcanyoutrustformallyverifiedsoftware?

Page 9: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited9

ArmArchitectureReferenceManual(ARMARM)

32-bit/64-bitInstructionsExceptions/InterruptsPrivilege/SecurityVirtualMemorySystemregistersDebug/Trace

Profiling…

Pages

0

1600

3200

4800

6400

1996 2007 2018

Page 10: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited10

Englishprose

Page 11: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited11

Pseudocode

Page 12: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited12

ArmArchitectureSpecificationLanguage(ASL)

Indentation-basedsyntax

Imperative

First-order

Stronglytyped(typeinference,polymorphism,dependenttypes)

Bit-vectors

Unboundedintegers

Infiniteprecisionreals

Arrays,Records,Enumerations

Exceptions

Page 13: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited13

Interpreter

CBackend

ASLSpecLexerParser

Typechecker

Page 14: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited14

ArchitecturalConformanceSuite

Processorarchitecturalcompliancesign-off

Large• v8-A11,000testprograms,>2billioninstructions

• v8-M3,500testprograms,>250millioninstructions

Thorough• Testsdarkcornersofspecification

Page 15: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited15

TesdngPassRate

0

25

50

75

100

ISA Supervisor Hypervisor/Security

(ArdstsImpression)

Time

15

Page 16: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited16

v8-A

0%

25%

50%

75%

100%

16

Page 17: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited17

Measuringarchitecturecoverageoftests

Untested: op1*op2 == -3.0, FPCR.RND=-Inf

Page 18: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited18

Page 19: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

Formalverificationofprocessors

“EndtoEndVerificationofARMprocessorswithISAFormal,”CAV2016

Page 20: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

ARMResearch

Checkinganinstrucdon

20

ADDCMPLDR STRBNE

Context

Page 21: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited21

Memory

R0-

R15DecodeFetch

EX MEM WBIF ID

R0-

R15

πpre

πpost

Pre Post_spec

Post_cpu

Spec ==?

Page 22: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

ARMResearch 22

CombinationalVerilog

ASL to Verilog

ArchitectureSpecification

SpecializeMonomorphize

ConstantPropagationWidthAnalysis

ExceptionHandling…

Page 23: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited23

ArmCPUsverifiedwithISA-Formal

A-class

Cortex-A53Cortex-A32Cortex-A35Cortex-A55Nextgeneration

R-class

Cortex-R52Nextgeneration

M-class

Cortex-M4Cortex-M7Cortex-M33Nextgeneration

CambridgeProjects

Rollingoutgloballytootherdesigncentres

Sophia,France-Cortex-A75(partial)Austin,USA-TBAChandler,USA-TBA

Page 24: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited24

Page 25: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

Formalvalidationofspecifications

“Whoguardstheguards?FormalValidationofARMv8-MSpecifications”OOPSLA2017

Page 26: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited26

Suppose…

Lastyear:auditedallaccessestoprivilegedregisters

• Specification:Addedmissingprivilegechecks

• Testsuite:Addednewteststotesteveryprivilegecheck

• Formaltestbench:Verifyeverycheck

Thisyear:addnewinstructionbutaccidentallyomitprivilegecheck

Howmanytestsinthetestsuitewillfailonnewspecification?

Page 27: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited27

Canweformallyverifyspecification?

SpecificationofthespecificationDisallowedbehaviour

Invariants

Cross-cuttingproperties

ToolsthatcanprovepropertiesofASLspecifications

Page 28: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

State

OutputInput

State

28

ExceptionEntry

TakeReset

Page 29: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited29

rule lockup_exit

assume Fell(LockedUp);

Called(TakeColdReset)

∨ Called(TakeReset)

∨ Rose(InDebugState())

∨ Called(ExceptionEntry);

Page 30: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited30

ConvertingASLtoSMT

FunctionsLocalVariablesStatements

AssignmentsIf-statements

ExceptionsArithmeticoperationsBooleanoperationsBitVectorsArrays

FunctionsLocalVariablesStatements

AssignmentsIf-statements

ExceptionsArithmeticoperationsBooleanoperationsBitVectorsArrays

Page 31: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

BuginSpec

12BugsFoundsofar

31

FormallyValidatingSpecifications

v8-M Spec

Verification

CEX

Property Proof

Page 32: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

rulelockupentryassumeRose(LockedUp);assume¬Called(TakeReset);

propertyaHaveMainExt()⇒CFSR!=0;propertyb1Stable(ExnPending);propertyb2Stable(ExnActive);propertycPC==0xEFFFFFFE;propertyeHFSR.FORCED==0;

32

Debug view of

is not changed.

Stable(HFSR.FORCED);

Page 33: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited33

Page 34: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited34

PublicreleaseofmachinereadableArmspecification

Enableformalverificadonofsomwareandtools

Releases

April2017:v8.2

July2017:v8.3

WorkingwithCambridgeUniversityREMSgrouptoconverttoSAIL

BackendsforHOL,OCaml,Memorymodel,(Coqjuststarted)

Tools:hpps://github.com/alastairreid/mra_tools

TalktomeabouthowIcanhelpyouuseit

Page 35: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited

Howcanyoutrustformallyverifiedsoftware?

Page 36: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

©2017ArmLimited36

Howcanyoutrustformalspecifications?

Testthespecificationsyoudependon

Ensurespecificationshavemultipleuses

Createmeta-specifications

https://xkcd.com/1416/

Page 37: How can you trust formally verified software? GLA 1 Sept 2017 · How can you trust formally verified software? How can you trust formally verified software? Specifications are part

ThankYou!Danke!Merci!谢谢!ありがとう!Gracias!Kiitos!

©2017ArmLimited37

@alastair_d_reid

“TrustworthySpecificationsoftheARMv8-Aandv8-Marchitecture,”FMCAD2016

“Whoguardstheguards?FormalValidationofARMv8-MSpecifications”OOPSLA2017“EndtoEndVerificationofARMprocessorswithISAFormal,”CAV2016