Outline Introduction 1 Reproducibility 2 Bootstrappability 3 - - PowerPoint PPT Presentation

outline
SMART_READER_LITE
LIVE PREVIEW

Outline Introduction 1 Reproducibility 2 Bootstrappability 3 - - PowerPoint PPT Presentation

GNU Mes Scheme-only bootstrap janneke@gnu.org FOSDEM20 2020-02-02 janneke@gnu.org (FOSDEM20) GNU Mes Scheme-only bootstrap 2020-02-02 1 / 62 Outline Introduction 1 Reproducibility 2 Bootstrappability 3 Thanks 4


slide-1
SLIDE 1

GNU Mes – Scheme-only bootstrap

janneke@gnu.org

FOSDEM’20

2020-02-02

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 1 / 62

slide-2
SLIDE 2

Outline

1

Introduction

2

Reproducibility

3

Bootstrappability

4

Thanks

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 2 / 62

slide-3
SLIDE 3

Scheme-only bootstrap: Why?

Why bootstrapping is important to you.

  • r

Why bootstrapping is something you wish to ignore.

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 3 / 62

slide-4
SLIDE 4

Scheme-only bootstrap: GNU Mes

GNU Mes

A Scheme interpreter written in ~5,000LOC of simple C. A C compiler written in Scheme. Built on LISP: eval/apply, the Maxwell Equations of Software.

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 4 / 62

slide-5
SLIDE 5

Auditable Elegance

(define (apply fn x a) (cond ((atom fn) (cond ((eq fn CAR) (caar x)) ((eq fn CDR) (cdar x)) ((eq fn CONS) (cons (car x) (cadr x))) ((eq fn ATOM) (atom (car x))) ((eq fn EQ) (eq (car x) (cadr x))) (#t (apply (eval fn a) x a)))) ((eq (car fn) LAMBDA) (eval (caddr fn) (pairlis (cadr fn) x a))) ((eq (car fn) LABEL) (apply (caddr fn) x (cons (cons (cadr fn) (caddr fn)) a))))) (define (eval e a) (cond ((atom e) (cdr (assoc e a))) ((atom (car e)) (cond ((eq (car e) QUOTE) (cadr e)) ((eq (car e) COND) (evcon (cdr e) a)) (#t (apply (car e) (evlis (cdr e) a) a)))) (#t (apply (car e) (evlis (cdr e) a) a))))

eval and apply are mutual recursing functions that—using a few helper functions—describe the universe of computing.

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 5 / 62

slide-6
SLIDE 6

Long path: Best Practice 500+ MB: no bootstrap

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 6 / 62

slide-7
SLIDE 7

Guix pronounced geeks

slide-8
SLIDE 8

Reduce binary seeds to bare minimum

These big chunks of binary code are practically non-auditable which breaks the source to binary transparency that we get in the rest of the package dependency graph. Every unauditable binary leaves us vulnerable to compiler back- doors as described by Ken Thompson in the 1984 paper Reflections

  • n Trusting Trust.

Thus, our goal is to reduce the set of bootstrap binaries to the bare minimum. – Ludovic Courtès (GNU Guix documentation, December 2017)

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 9 / 62

slide-9
SLIDE 9

A big problem, predicted 40y ago

slide-10
SLIDE 10

Long path: Ignoring the Problem 500+ MB: no bootstrap

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 12 / 62

slide-11
SLIDE 11

Long path: GNU Guix System v1.0 500+ MB: no bootstrap 252 MB: GNU Guix System v1.0

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 13 / 62

slide-12
SLIDE 12

Carl Dong – bitcoin build system security

slide-13
SLIDE 13

Reproducible-Builds.org

slide-14
SLIDE 14

What is a Bootstrap?

Impossible task: pull yourself up on your boot straps Software: to create your first: kernel, shell, C compiler, . . .

source+ ?? = binary

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 18 / 62

slide-15
SLIDE 15

How to Bootstrap: An Old Recipe. . .

Recipe for yoghurt: Add yoghurt to milk – Anonymous

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 19 / 62

slide-16
SLIDE 16

How to Bootstrap: Create your second GCC

Traditional recipe: like yoghurt

source+ binary - 1= binary

. . . and done!

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 20 / 62

slide-17
SLIDE 17

Pour milk

slide-18
SLIDE 18

Add yoghurt

slide-19
SLIDE 19

We’re reproducible

slide-20
SLIDE 20

Add evil yoghurt

slide-21
SLIDE 21

We’re reproducible

slide-22
SLIDE 22

Evil yoghurt

slide-23
SLIDE 23

We’re reproducibly malicous

slide-24
SLIDE 24

Reproducibility is not enough

slide-25
SLIDE 25

Reproducibility plus clean source code is not enough

slide-26
SLIDE 26

Guix pronounced geeks

slide-27
SLIDE 27

Long path: Reduced Binary Seed bootstrap 500+ MB: no bootstrap 252 MB: GNU Guix System v1.0 145 MB: Reduced Binary Seed

master branch GCC, GLIBC, Binutils + MesCC-Tools, + Mes

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 41 / 62

slide-28
SLIDE 28

GCC mesboot0

slide-29
SLIDE 29

NLnet Foundation

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 44 / 62

slide-30
SLIDE 30

Long path: Scheme-only bootstrap 500+ MB: no bootstrap 252 MB: GNU Guix System v1.0 145 MB: Reduced Binary Seed

master branch GCC, GLIBC, Binutils + MesCC-Tools, + Mes

57 MB: Scheme-only

wip-bootstrap branch Awk, Bash, Bzip2, GNU Core Utilities, Grep, Gzip, Make, Patch, Sed, Tar, and XZ. + Gash (source only!)

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 45 / 62

slide-31
SLIDE 31

Scheme-only bootstrap: Gash Core Utils

awk cp gash mv sleep uname basename cut grep pwd sort uniq bash diff gzip reboot tar wc cat dirname head rm test which chmod expr ln rmdir touch cmp false ls sed tr compress find mkdir sh true

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 46 / 62

slide-32
SLIDE 32

GCC core-mesboot0-scheme-only

slide-33
SLIDE 33

GCC mesboot0-scheme-only

slide-34
SLIDE 34

Cross distro reproducibility

The sha256sum for bin/mes-mescc on x86 shall be

722790ed261954eb53cf2cd2906c89c7589ef72b66171bbe2a9dce0f0af20232 v0.22 9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb v0.21

  • nly differing in the version number string.

For v0.21 this has been verified on Guix System, Debian GNU/Linux and NixOS.

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 51 / 62

slide-35
SLIDE 35

The holy grail

The holy grail of bootstrappability will be connecting mes to hex0. – Carl Dong, Chaincode Labs

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 52 / 62

slide-36
SLIDE 36

Full Source Bootstrap

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 53 / 62

slide-37
SLIDE 37

Long path: Full Source Bootstrap 500+ MB: no bootstrap 252 MB: GNU Guix System v1.0 145 MB: Reduced Binary Seed

master branch GCC, GLIBC, Binutils + MesCC-Tools, + Mes

57 MB: Scheme-only

wip-bootstrap branch Awk, Bash, Bzip2, GNU Core Utilities, Grep, Gzip, Make, Patch, Sed, Tar, and XZ. + Gash (source only!)

357 bytes: Full Source

MesCC-Tools, Mes + Stage0: 357 bytes (x86)

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 54 / 62

slide-38
SLIDE 38

Trusted Computing Base

slide-39
SLIDE 39

Trusted Computing Base

Source code Binary seeds Guix System Linux

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 57 / 62

slide-40
SLIDE 40

Raising the bar on auditibility

I want code easy to reason about at the heart of this bootstrap, so that everyone will be able to sit down in the morning and be done by lunch time; understanding how every piece of it works. – Jeremiah Orians

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 58 / 62

slide-41
SLIDE 41

Won’t your life be boring?

MesCC should optimize for the ease of convincing us of its correct-

  • ness. – Mark H Weaver

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 59 / 62

slide-42
SLIDE 42

Joy of Source

Vulnerability to a trusting trust attack is a symptom of an unauditable or missing bootstrap story. – janneke

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 60 / 62

slide-43
SLIDE 43

Thanks

Carl Dong Danny Milosavljevic David Terry Jeremiah Orians Ludovic Courtès Matt Wette Pjotr Prins Rutger van Beusekom Timothy Sample Vagrant Cascadian

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 61 / 62

slide-44
SLIDE 44

Want to join?

You can help

make Guix run on Mes write a bootstrappable syntax-case simplify MesCC and target GCC-4.6 bootstrap NixOS, Debian port MesCC to the Hurd, FreeBSD spread the message retweet @janneke_gnu janneke@octodon.social

Connect

irc freenode.net #bootstrappable #guix mail bug-mes@gnu.org guix-devel@gnu.org git https://git.savannah.gnu.org/git/mes.git web bootstrappable.org

janneke@gnu.org (FOSDEM’20) GNU Mes – Scheme-only bootstrap 2020-02-02 62 / 62