rust - acm learning center...null pointers • data races #-pulser_g2, a demonstration of...

140
Rust In It for the Long Haul Carol (Nichols || Goulding) @carols10cents

Upload: others

Post on 26-Feb-2021

2 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

RustIn It for the Long Haul

Carol (Nichols || Goulding) @carols10cents

Page 2: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

is.gd/rustLH

Page 5: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Integer 32

Page 6: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Rust Core Team

Page 7: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

(yep, I’m biased)

Page 8: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks
Page 9: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Plan•Railroad industry

•C

•Rust

•What the software industry can learn from the railroad industry

Page 10: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Plan➡ Railroad industry

•C

•Rust

•What the software industry can learn from the railroad industry

Page 11: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

1830

Page 12: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Miles of Rail in the US

0

35,000

70,000

105,000

140,000

1840 1850 1860 1870 1880 1890

Wikipedia

Page 13: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Brakeman

Engraving by PeckwellPublished 1890 in The Railroad ConductorPublic Domain in the US, Wikipedia

Page 14: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

George Westinghouse

Photo: public domain in the US, Wikipedia

Page 15: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Air Brakes•Compressed air

•Controls in the locomotive

•Air lines connecting all cars

•Apply brakes all at once

•Brakes on when there’s no pressure

Page 16: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

– Cornelius Vanderbilt, owner of the New York Central Railroad

“Do you pretend to tell me that you could stop trains

with air?”

Page 17: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Ad in 1936 Railway AgePublic Domain in the US, Wikipedia

Page 18: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Ad in 1936 Railway AgePublic Domain in the US, Wikipedia

“The swift operation of these nightly carriers is safeguarded by Westinghouse Air Brakes”

Page 19: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

–L.S. Coffin, Iowa Railroad Commissioner, Senate Hearing, 1890

“They thought it was a necessity somehow, that it occurred as a matter of course, that

some men had to be killed.”

Page 20: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

–Mr. Roberts, President of the Pennsylvania Railroad Company, Senate Hearing, 1890

“If you are going to subject the railroad companies to this class of supervision, then you might as well

go into the character of bridges, which is as serious a question as we have to deal with, and say that the bridges must conform to such and

such standards.”

Page 21: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

US Railroad Safety Appliance Act

1893

Page 22: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Act fully enforced1900

Page 23: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Not perfect; Vast improvement

Page 24: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Plan•Railroad industry

➡ C

•Rust

•What the software industry can learn from the railroad industry

Page 25: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

why C?

Page 26: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

performance👍

Page 27: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

portability👍

Page 28: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

simplicity👍

Page 29: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

legacy code👍

Page 30: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

stability👍

Page 31: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

memory unsafety👎👎👎👎👎👎👎

Page 32: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Memory Safety Problems•Use after free•Double free•Memory leaks•Buffer overreads/overwrites•Null pointers•Data races

Page 33: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Memory Safety Problems•Use after free•Double free•Memory leaks•Buffer overreads/overwrites•Null pointers•Data races

😱

Page 34: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

-Pulser_G2, A Demonstration of Stagefright-like Mistakes

“The best way to prevent these kinds of attacks is either to use a higher level language, which

manages memory for you (albeit with less performance), or to be very, very, very, very careful when coding. More careful than the

entirety of the Android security team, for sure.”

Page 35: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

–Catalin Cimpanu reporting on a presentation by Matt Miller, MS security engineer. ZDNet, 2019-02-11

“Around 70 percent of all the vulnerabilities in Microsoft products addressed through a

security update each year are memory safety issues”

Page 36: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Efforts to make C safer

Page 37: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

valgrind

Page 38: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

ASAN

Page 39: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

UBSAN

Page 41: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

MISRA

Page 42: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Write code THEN

make it safe

Page 44: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

C++

Page 45: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Plan•Railroad industry

•C

➡ Rust

•What the software industry can learn from the railroad industry

Page 46: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Rust

Page 47: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

#1: Fixes common memory safety

problems

Page 48: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Ownership Borrowing

Page 49: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

println!("{}", x);

}

Page 50: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

println!("{}", x);

}

Allocates memory

Page 51: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

println!("{}", x);

}

Allocates memory

Owner

Page 52: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

println!("{}", x);

}

Allocates memory

Owner

Owner goes out of scope, memory is cleaned up

Page 53: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

let y = x;

println!("{}", x);

}

Page 54: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

let y = x;

println!("{}", x);

}

Moves ownership

Page 55: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

let y = x;

println!("{}", x);

}

error[E0382]: borrow of moved value: `x`

- value moved here

^ value borrowed here after move

Page 56: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

let y = &x;

println!("{}", x);

}

Page 57: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

let y = &x;

println!("{}", x);

}

Immutable borrow

Page 58: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let x = String::from("hi");

let y = &x;

println!("{}", x);

println!("{}", y);

}

Page 59: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let y = {

let x = String::from("hi");

&x

};

println!("{}", y);

}

Page 60: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let y = {

let x = String::from("hi");

&x

};

println!("{}", y);

}

Returning a reference

Page 61: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

fn main() {

let y = {

let x = String::from("hi");

&x

};

println!("{}", y);

}

Returning a referencex is cleaned up

Page 62: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

error[E0597]: `x` does not live long enough --> src/main.rs:4:9 |2 | let y = { | - borrow later stored here3 | let x = String::from("hi");4 | &x | ^^ borrowed value does not live long enough5 | }; | - `x` dropped here while still borrowed

Page 63: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Rust Safety• Either one mutable reference OR many immutable references

• No null, only Option

• Out-of-bounds access = at runtime, program stops

• Ownership rules apply across multiple threads

Page 64: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Computers are good at tedium.

⚠ Beep, boop. You forgot a semicolon in 23,982 places

Page 65: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

#2: Systems programming is for

superhumans everyone

Page 66: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

unsafe

Page 67: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Unsafe code can…•Dereference a raw pointer

•Call an unsafe function

• Implement unsafe traits

•Mutate global variables

• Access fields of unions

Page 68: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

👋 Look here for the cause of memory

problems! 👋

Page 69: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Opt OUT

Page 70: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Further unsafe Info•Building on an Unsafe Foundation -

Jason Orendorff, RBR 2018

•The Rustonomicon

Page 71: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Logic bugs

Page 72: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Tests

Page 73: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Fuzzers

Page 74: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

memory safety👍 👍

Page 75: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

performance👍

Page 76: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

portability👍👎

Page 77: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

simplicity👎

Page 78: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

legacy code👍

Page 79: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

legacy codeMy "Rust out your C" Talk

Page 80: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

stability👍

Page 81: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

stability👍

**We reserve the right to fix compiler bugs, patch safety holes, and change type inference in ways that may occasionally require new type annotations. We do not expect any of these changes to cause headaches when upgrading Rust. (more detailed documentation)

Page 82: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Has upgrading broken your code?

Yes - 7.4%

No - 92.6%

Page 83: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

#3: stability without

stagnation

Page 85: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Source code

Page 86: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Source code HIR

Page 87: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Source code HIR MIR

Page 88: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Source code HIR MIR LLVM

IR

Page 89: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Source code HIR MIR LLVM

IRMachine

code

Page 90: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Source code HIR MIR

Borrow checking, Optimizations,

Code generation

LLVM IR

Machine code

Page 91: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

2015 Edition Source Code

HIR

MIR

Borrow Checking, Optimizations,

Code Generation

LLVM IR

Machine Code

2018 Edition Source Code

HIR

Page 92: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

No ecosystem split!!!

Rust 2015 Library

Rust 2018 Library

Rust 2018 Project

Rust 2015 Project

Page 93: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

You pick when to switch editions

(never is totally fine!)

Page 94: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

rustfix

Page 95: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Rust 2.0X

Page 96: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

// TODO• ISO/ECMA Standard

•Compiler certification

• LTS Release

•Better cargo/build system integration

•Private crate hosting

• Improved ecosystem

Page 97: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

#4: Large Enterprises are

using Rust

Page 98: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Mozilla

Page 99: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

CSS Component

Implications of Rewriting a Browser Component in Rust

By Diane Hosfelt, 2019-02-28

Page 100: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

CSS Component• Security bugs since Firefox started: 69

Implications of Rewriting a Browser Component in Rust

By Diane Hosfelt, 2019-02-28

Page 101: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

CSS Component• Security bugs since Firefox started: 69

•Rust would have prevented: 51

Implications of Rewriting a Browser Component in Rust

By Diane Hosfelt, 2019-02-28

Page 102: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

CSS Component• Security bugs since Firefox started: 69

•Rust would have prevented: 51

73.9%Implications of Rewriting a Browser Component in Rust

By Diane Hosfelt, 2019-02-28

Page 103: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

AppAmaGooBookSoft•Apple

•Amazon - Firecracker

•Google - Fuchsia

•Facebook - Mononoke

•Microsoft - IoT Edge

Page 104: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

#5: Rust Governance

Page 105: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

No BDFL

Page 106: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Teams and Working Groups• Programming language theorists and designers

• Enterprise users

• Hobby users

• People from low-level languages

• People from high-level languages

• People from functional languages

Page 107: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Decisions made via public RFCs

Page 108: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Code of Conduct

Page 109: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Rust’s staying power• Significant improvement in memory safety over the

status quo

• More programmers can write and maintain it

• Editions enable stability without stagnation

• Large companies are depending on it

• Governance set up to endure

Page 110: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Plan•Railroad industry

•C

•Rust

➡ What the software industry can learn from the railroad industry

Page 111: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Silicon Valley arrogance

Page 112: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Juicero shows what’s wrong with Silicon Valley thinking

–Christine Emba, Washington Post, 2017-04-24

Page 113: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

The Lyft Shuttle is pretty much a glorified city bus — with fewer poor people

–Keith Spencer, Salon, 2017-06-19

Page 114: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

–Nick Allen, The Telegraph, 2018-07-14

Elon Musk ‘can stick his submarine where it hurts’ says British diver who helped Thai cave rescue

Page 115: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Trains not stopping = people dying

Page 116: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Memory unsafety?? = ???

Page 117: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

Page 118: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

WannaCry Ransomware May 2017

Page 119: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

Page 120: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

+ =X

Page 121: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

+ =X

Page 122: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

+ =XX

Page 123: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Actual Consequences

+ =

Images from Shastry, Eucalyp, and Maxim Kulikov via the Noun Project

XX people

dying

Page 124: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

July 17, 2019 House Financial Services Committee

Hearing on Facebook’s Libra Cryptocurrency

Page 125: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

July 17, 2019 House Financial Services Committee

Hearing on Facebook’s Libra Cryptocurrency

Congressman Riggleman of Virginia

Page 126: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

July 17, 2019 House Financial Services Committee

Hearing on Facebook’s Libra Cryptocurrency

Congressman Riggleman of Virginia

David Marcus Head of Calibra at Facebook

Page 127: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks
Page 128: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Not the norm!!!

Page 129: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

We are our own informed consumers

Page 130: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

1830 -> 1869 -> 190039 years 31 years

Page 131: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

1973 -> 2015 -> ????42 years ?? years

Page 132: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Are we better?

Page 133: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

RustIn It for the Long Haul

Page 134: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

RustIn It for the Long Haul???

Page 135: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

I could be wrong!

Page 136: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks
Page 137: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks
Page 138: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

Why not all of them? 🤷

Page 139: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

new mistakes!

Page 140: Rust - ACM Learning Center...Null pointers • Data races #-Pulser_G2, A Demonstration of Stagefright-like Mistakes “The best way to prevent these kinds of attacks

50% off Rust in Motion course at

manning.com: tsrust

is.gd/rustLH @carols10cents