Slide 1

Slide 1 text

Kugelsichere Architektur mit formalen Methoden Bianca Lutz (Active Group) Lars Hupel (Giesecke+Devrient) 2024-04-25

Slide 2

Slide 2 text

list.sort((x, y) -> x.foo.compareTo(y.foo) ) Sortieren in Java

Slide 3

Slide 3 text

Woran hat es gelegen?

Slide 4

Slide 4 text

Bianca ● Informatikstudium an der TU Berlin ● mehrere Jahre Anwendungsentwicklerin bei einer Rentenversicherung (Wartung und Modernisierung eines SAP-Legacy-Systems) ● aktuell: Haskell- und Clojure-Entwicklerin

Slide 5

Slide 5 text

Lars ● hat an der TUM im Bereich Compilerbau promoviert ● aktuell: Digitalwährungen für Zentralbanken ● auch: Forschungsprojekt über Lieferkettensicherheit

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Ausführbare Spezifikationen: Cucumber

Slide 8

Slide 8 text

“Executable specifications are requirements written as tests that are automated.” https://bluefruit.co.uk/processes/executable- specifications-software-development/

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Wo müsste in eurem Code etwas schiefgehen, dass die Tagesschau berichtet?

Slide 12

Slide 12 text

Fallbeispiel 1: Tachometer

Slide 13

Slide 13 text

Richtlinie 75/443/EWG Euro NCAP

Slide 14

Slide 14 text

Wie wird die Geschwindigkeit ermittelt? A. Aniculaesei, M. Zhang, A. Rausch: Data- driven Approach for Accurate Estimation and Validation of Ego-Vehicle Speed (ICONS 2020)

Slide 15

Slide 15 text

Requirements Analysis Construction of the Abstract System Model System Validation Test A. Aniculaesei, M. Zhang, A. Rausch: Architecture-based Hybrid Approach to Verify Safety-critical Automotive System Functions by Combining Data-driven and Formal Methods (ICSA-C)

Slide 16

Slide 16 text

“The results of the system verification test have shown that a first version of the speed estimation function did not satisfy the Euro NCAP requirement.” A. Aniculaesei, M. Zhang, A. Rausch: Architecture-based Hybrid Approach to Verify Safety-critical Automotive System Functions by Combining Data-driven and Formal Methods (ICSA-C)

Slide 17

Slide 17 text

Probabilistische Verifikation mit Storm ● Storm ist ein Analysewerkzeug für Systeme mit Zufalls- Komponenten ● wir können überprüfen, ob eine formale Anforderung mit einer vordefinierte Wahrscheinlichkeit durch das Eingabemodell erfüllt wird oder nicht ● wir können auch die minimale und die maximale Wahrscheinlichkeit berechnen, womit eine gegebene Anforderung erfüllt wird oder nicht γ, 0.8 α, 0.5 α, 0.5 β, 0.2

Slide 18

Slide 18 text

Fallbeispiel 2: Embedded-Betriebssystem

Slide 19

Slide 19 text

seL4 ● Mikrokernel ● Varianten in Qualcomm-Modems und iPhone-Security-Enklave ● funktionale Korrektheit bewiesen (2009) ● Beweis: 200.000 LoC User Mode →  Kernel Mode G. Heiser: The seL4 Microkernel – an Introduction

Slide 20

Slide 20 text

“Functional correctness means here that the implementation always strictly follows our high-level abstract specification of kernel behaviour. This encompasses […] properties such as the kernel will never crash, and it will never perform an unsafe operation. It also proves much more: we can predict precisely how the kernel will behave in every possible situation.” G. Klein et al.: seL4: formal verification of an OS kernel (SOSP 2009)

Slide 21

Slide 21 text

seL4: Entwicklungsprozess G. Klein et al.: seL4: formal verification of an OS kernel (SOSP 2009)

Slide 22

Slide 22 text

Isabelle ● Beweisassistent für verschiedene Logiken ● am häufigsten verwendet: Higher Order Logic (= Funktionale Programmierung + Logik) ● Sprache für Beweise + IDE ● mathematische Syntax für Mengen, Algebra, Analysis, … ● Code-Export nach SML, OCaml, Haskell und Scala ● Archive of Formal Proofs umfasst viele konkrete Beispielanwendungen: https://www.isa-afp.org/

Slide 23

Slide 23 text

Fallbeispiel 3: Compiler

Slide 24

Slide 24 text

CompCert ● C Compiler für ARM, PowerPC, x86 und RISC-V ● unterstützt einen Großteil von ISO C 99, einen Teil von ISO C 2011 und einige Erweiterungen aus GNU C und Diab C ● Compiler ist implementiert und verifiziert in Coq ● Nachweis von „Semantic Preservation“ zwischen Input und Output in allen Compiler-Durchläufen ● AbsInt GmbH vertreibt eine industrietaugliche CompCert-Version ● Airbus verwendet den Compiler für sicherheitskritische Anwendungen

Slide 25

Slide 25 text

Semantic Preservation If the compiler produces compiled code C from source code S, without reporting compile-time errors, then every observable behavior of C is either identical to an allowed behavior of S, or improves over such an allowed behavior of S by replacing undefined behaviors with more defined behaviors. https://compcert.org/motivations.html

Slide 26

Slide 26 text

Coq ● Formal Proof Management System ● Sprache für mathematische Definitionen, ausführbare Programme und mathematische Beweise ● Anbindung an verschiedene IDEs ● Emacs, Vim, VSCode, jsCoq ● Code-Extraktion nach OCaml, Haskell und Scheme

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Was sind denn nun formale Methoden? Specification Coverage Rigor Implementation Type system First-order logic Model checking State machines Theorem prover Property testing Flowchart

Slide 29

Slide 29 text

ISO 5807 Flowchart

Slide 30

Slide 30 text

Ausführbare Spezifikationen

Slide 31

Slide 31 text

1. Formeln tun nicht weh. 2. Schreibt Eigenschaften. 3. Testet Eigenschaften. 4. Beweist Eigenschaften. 5. Formale Methoden sorgen für besseren Schlaf.

Slide 32

Slide 32 text

Ausblick … https://github.com/isaqb-org/curriculum-fm Advanced Level Curriculum Formal Methods (FM)

Slide 33

Slide 33 text

Questions? Answers! Lars Hupel [email protected] https://lars.hupel.info Bianca Lutz [email protected]