SlideShare ist ein Scribd-Unternehmen logo
1 von 62
Entering
Ring
Naught
Plan for Today
Review (Exam 1 Questions)
Milestones in Computing
Building a Kernel
1
Reminder: PS4 (part 1) is out now. If you
want to have more time to work on your
project idea instead of PS4, need to let me
know this week.
Everyone should have
received an email with
the recorded results for
PS2, PS3, and Exam 1.
No Exam 2, 30
Final
Instead, 2
Another
Assignment, 1
March 20-
21, 14
March 25-
27, 37
Near End of
Semester, 11
Took it
already!, 1
Exam2
2
No Exam 2, 30
Final
Instead, 2
Another
Assignment, 1
March 20-
21, 14
March 25-
27, 37
Near End of
Semester, 11
Took it
already!, 1
Exam2
3
Exam 2 will be out March 25
and due March 27 (12:25pm)
Talk After Class Today!
4
Cyber War, Cyber Peace,
Stones, and Glass Houses
Gary McGraw, CTO Cigital
2:00 PM
Rice Hall 130
5
6
“What is significant about the bakery algorithm
is that it implements mutual exclusion without
relying on any lower-level mutual exclusion.
Assuming that reads and writes of a memory
location are atomic actions, as previous mutual
exclusion algorithms had done, is tantamount
to assuming mutually exclusive access to the
location. So a mutual exclusion algorithm that
assumes atomic reads and writes is assuming
lower-level mutual exclusion. Such an
algorithm cannot really be said to solve the
mutual exclusion problem. Before the bakery
algorithm, people believed that the mutual
exclusion problem was unsolvable--that you
could implement mutual exclusion only by
using lower-level mutual exclusion.”Communications of the
ACM, August 1974 (2 pages)
We will explore this next Tuesday!
What are the
advantages/disadvantages of
hardware-based memory isolation
over software-based memory
isolation?
7
8
Hardware Memory Isolation
a[i] = x mem.rs
9
Hardware Memory Isolation
STR r0, [r1]
a[i] = x
compiler
assembler
rustc
as
0100101101011…
mem.rs
mem
10
Hardware Memory Isolation
STR r0, [r1]
a[i] = x
compiler
assembler
rustc
as
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
11
Hardware Memory Isolation
STR r0, [r1]
a[i] = x
WRITE 0x57283952, 0x413024
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
compiler
assembler
rustc
as
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
12
Hardware Memory Isolation
STR r0, [r1]
a[i] = x
WRITE 0x57283952, 0x413024
compiler
assembler
rustc
as
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
FAIL!
Hardware Memory Protection
13
Page
Table
+ L1 Index
14
15
Software-Based Memory Isolation?
STR r0, [r1]
a[i] = x
WRITE 0x57283952, 0x413024
compiler
assembler
rustc
as
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
FAIL!
16
Software-Based Memory Isolation
…lots of code…
STR r0, [r1]
a[i] = x
WRITE 0x57283952, 0x413024
compiler
assembler
rustc
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
17
Software-Based Memory Isolation
…lots of code…
STR r0, [r1]
a[i] = x
WRITE 0x57283952, 0x413024
compiler
assembler
rustc
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
fn main() {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
}
> rustc oob.rs
> ./oob
task '<main>' failed at 'index out of bounds: the len is 4
but the index is 6', oob.rs:5
18
rustc -S oob.rsLtmp4:
…
movq $6, -40(%rbp)
movq -40(%rbp), %rcx
cmpq $4, %rcx
setae %dl
testb $1, %dl
movq %rdi, -48(%rbp)
movq %rax, -56(%rbp)
movq %rcx, -64(%rbp)
jne LBB0_2
movq -56(%rbp), %rax
movq -64(%rbp), %rcx
movq $7, (%rax,%rcx,8)
addq $64, %rsp
popq %rbp
ret
LBB0_2:
leaq _str1253(%rip), %rsi
movabsq $5, %rdx
movabsq $4, %r8
movq -64(%rbp), %rcx
callq __ZN8unstable4lang17fail_bounds_check19h71a9f1
.cfi_endproc
19
Software-Based Memory Isolation
…lots of code…
STR r0, [r1]
a[i] = x
jne LBB0_2
compiler
assembler
rustc
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
FAIL!
20
Software-Based Memory Isolation
…lots of code…
STR r0, [r1]
a[i] = x
jne LBB0_2
compiler
assembler
rustc
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
FAIL!
What if you aren’t
starting with source code
in a type-safe language?
21
Software-Based Memory Isolation
STR r0, [r1]
a[i] = x
jne LBB0_2
compiler
assembler
rustc
0100101101011…
mem.rs
mem
process
running code
gash> mem
loader
LogicalAddress
Segmentation
Unit
LinearAddress
Paging
Unit
PhysicalAddress
Memory
FAIL!transformer
/ loader
This is hard!
22
Which is more “expensive”?
Hardware-Based Memory Isolation
Transistors + wires
OS sets up page permissions, loads programs
Software-Based Memory Isolation
Trusted compiler/loader
Statically safe: no runtime cost!
23
Entering the
Kernel
24
Photo: RDTaken
Hello World?
25
fn main() {
println("Hello?");
}
1. What’s the difference between a
programming language and an
operating system?
26
27
Image: flickr cc: Ruben Alexander
28
Which came first?
• Early programming languages did not run on
an Operating System
– Turing’s language, Church’s Lambda Calculus
– IPL/Lisp, FLOW-MATIC, etc.
• Early operating systems were not written in
programming languages
29
Programming Language Operating System
30
Programming Language
• Mostly a precise way for
humans to describe programs
• Provides abstractions of
(abstract) machine resources
• Associated programs like
compilers translate into a
program for machines to
execute
• Modern programming
languages usually depend on
an underlying OS
Operating System
• A program that runs on some
hardware
• Provides abstractions for (real)
machine resources
• Manages sharing of machine
resources
• Modern operating systems are
mostly implemented in C
(arguably a programming
language) and assembly
31
Kernel Programming in Rust
32
#[no_std];
fn main() {
println("Hello?");
}
Kernel Programming in Rust
33
#[no_std];
fn main() {
println("Hello?");
} > rustc hello.rs
hello.rs:4:5: 4:12 error: unresolved name `println`.
hello.rs:4 println("Hello?");
^~~~~~~
error: aborting due to previous error
Printing is For The Weak!
34
#[no_std];
fn main() {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
}
Main is For The Weak!
35
#[no_std];
fn main() {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
}
> rustc oob1.rs
error: requires `start` lang_item
36
#[no_std];
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
}
37
#[no_std];
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
}
gash> rustc oob2.rs
oob2.rs:4:1: 9:2 error: not all control paths return a value
oob2.rs:4 fn main(_: int, _: **u8) -> int {
oob2.rs:5 let mut a = [0, 1, 2, 3];
oob2.rs:6 let i = 6;
oob2.rs:7
oob2.rs:8 a[i] = 7;
oob2.rs:9 }
error: aborting due to previous error
38
#[no_std];
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
return 0;
}
39
rustc -S oob.rsLtmp4:
…
movq $6, -40(%rbp)
movq -40(%rbp), %rcx
cmpq $4, %rcx
setae %dl
testb $1, %dl
movq %rdi, -48(%rbp)
movq %rax, -56(%rbp)
movq %rcx, -64(%rbp)
jne LBB0_2
movq -56(%rbp), %rax
movq -64(%rbp), %rcx
movq $7, (%rax,%rcx,8)
addq $64, %rsp
popq %rbp
ret
LBB0_2:
leaq _str1253(%rip), %rsi
movabsq $5, %rdx
movabsq $4, %r8
movq -64(%rbp), %rcx
callq __ZN8unstable4lang17fail_bounds_check19h71a9f1
.cfi_endproc
40
#[no_std];
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
return 0;
}
bash-3.2$ rustc oob3.rs
oob3.rs:8:5: 8:8 error: requires `fail_bounds_check` lang_item
oob3.rs:8 a[i] = 7;
^~~
41
#[no_std];
extern "rust-intrinsic" { fn abort() -> !; }
#[no_mangle] pub extern fn rust_stack_exhausted() {
unsafe { abort() }
}
#[lang="fail_bounds_check"]
pub fn fail_bounds_check(_: *i8, _: uint, _: uint, _: uint) {
unsafe { abort() }
}
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
return 0;
}
42
#[no_std];
extern "rust-intrinsic" { fn abort() -> !; }
#[no_mangle] pub extern fn rust_stack_exhausted() {
unsafe { abort() }
}
#[lang="fail_bounds_check"]
pub fn fail_bounds_check(_: *i8, _: uint, _: uint, _: uint) {
unsafe { abort() }
}
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 6;
a[i] = 7;
return 0;
}
gash> rustc oob4.rs
gash> ./oob4
Illegal instruction: 4
43
#[no_std];
extern "rust-intrinsic" { fn abort() -> !; }
#[no_mangle] pub extern fn rust_stack_exhausted() {
unsafe { abort() }
}
#[lang="fail_bounds_check"]
pub fn fail_bounds_check(_: *i8, _: uint, _: uint, _: uint) {
unsafe { abort() }
}
#[start]
fn main(_: int, _: **u8) -> int {
let mut a = [0, 1, 2, 3];
let i = 2;
a[i] = 7;
return 0;
}
gash> rustc oob5.rs
gash> ./oob5
gash>
IronKernel
44
Kevin Broderick, Alex Lamana, Zeming
Lin, John Stevans, Wil Thomason
Building a Kernel
45
#[no_std] Remove everything from Rust that depends on OS:
everything that uses system calls
rust-core Library that doesn’t depend on OS.
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use fail::abort;
use mem::replace;
pub enum Option<T> {
Some(T),
None
}
impl<T> Option<T> {
/// Returns true if the option contains a `Some` value
pub fn is_some(&self) -> bool {
match *self {
Some(_) => true,
None => false
}
}
core/option.rs
46
/// Convert from `Option<T>` to `Option<&T>`
pub fn as_ref<'a>(&'a self) -> Option<&'a T> {
match *self { Some(ref x) => Some(x), None => None }
}
/// Convert from `Option<T>` to `Option<&mut T>`
pub fn as_mut<'a>(&'a mut self) -> Option<&'a mut T> {
match *self { Some(ref mut x) => Some(x), None => None }
}
/// Return the value in an `Option` or call `abort` if it is `None`.
pub fn get(self) -> T {
match self { Some(x) => x, None => abort() }
}
/// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.
pub fn map<U>(self, f: |T| -> U) -> Option<U> {
match self { Some(x) => Some(f(x)), None => None }
}
/// Applies a function to the contained value or returns a default.
pub fn map_or<U>(self, def: U, f: |T| -> U) -> U {
match self { None => def, Some(t) => f(t) }
}
/// Take the value out of the option, leaving a `None` in its place.
#[inline(always)]
pub fn take(&mut self) -> Option<T> {
replace(self, None)
}
}
Why does normal Option type need OS?
47
https://github.com/mozilla/rust/blob/master/src/libstd/option.rs
Almost all normal code relies on an underlying OS!
Building a Kernel
48
#[no_std] Remove everything from Rust that depends on OS:
everything that uses system calls
rust-core Library that doesn’t depend on OS.
rustboot
49
50
51
Building a Kernel
52
#[no_std] Remove everything from Rust that depends on OS:
everything that uses system calls
rust-core Library that doesn’t depend on OS.
rustboot Boot!
IronKernel 32-bit ARM OS kernel that can print text on the screen
(in many colors!), handle keyboard input (as long as you
don’t press any “dangerous” keys
53
Photo: flickr cc:Randy OHC
Kernel Programming
54
Development Machine
(Ubuntu 64-bit x86 Linux)
editors, file
system, networ
k, compilers
Target Machine
(32-bit ARM)
Kernel Programming
55
Development Machine
(Ubuntu 64-bit x86 Linux)
editors, file
system, networ
k,
cross-compilers
Target Machine
(32-bit ARM)
ARM
binary
Kernel Programming
56
Development Machine
(Ubuntu 64-bit x86 Linux)
editors, file
system, networ
k,
cross-compilers
QEMU: Emulator
(32-bit ARM)
ARM
binary
57
How the kernel is built:
> rustc --emit-llvm mod.rs
> llc -march=arm -mcpu=arm926ej-s mod.bc
> arm-none-eabi-as mod.as
> objcopy mod.o …
mod.rs
mod.bc
mod.s
mod.o
kernel.bin
rustc
llc
arm-none-eabi-as
objcopyassembler naming convention:
[processor]-[os]-[application binary interface]
58
How the kernel is built:
> rustc --emit-llvm mod.rs
> llc -march=arm -mcpu=arm926ej-s mod.bc
> arm-none-eabi-as mod.as
> objcopy mod.o …
mod.rs
mod.bc
mod.s
mod.o
kernel.bin
rustc
llc
arm-none-eabi-as
objcopyassembler naming convention:
[processor]-[os]-[application binary interface]
Easy way: make run
IronKernel Demo
59
60
*((addr + (i * 4)) as * mut u32) = val
61
Reminder: stay for
Gary McGraw talk!
Form PS4 Teams while you
are waiting for Gary’s talk!
A PS4 team can be
any 3 people.

Weitere ähnliche Inhalte

Was ist angesagt?

Kernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easyKernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easyAnne Nicolas
 
Making a Process
Making a ProcessMaking a Process
Making a ProcessDavid Evans
 
Putting a Fork in Fork (Linux Process and Memory Management)
Putting a Fork in Fork (Linux Process and Memory Management)Putting a Fork in Fork (Linux Process and Memory Management)
Putting a Fork in Fork (Linux Process and Memory Management)David Evans
 
Class 1: What is an Operating System?
Class 1: What is an Operating System?Class 1: What is an Operating System?
Class 1: What is an Operating System?David Evans
 
Crossing into Kernel Space
Crossing into Kernel SpaceCrossing into Kernel Space
Crossing into Kernel SpaceDavid Evans
 
Scheduling in Linux and Web Servers
Scheduling in Linux and Web ServersScheduling in Linux and Web Servers
Scheduling in Linux and Web ServersDavid Evans
 
Virtual Memory (Making a Process)
Virtual Memory (Making a Process)Virtual Memory (Making a Process)
Virtual Memory (Making a Process)David Evans
 
Where destructors meet threads
Where destructors meet threadsWhere destructors meet threads
Where destructors meet threadsShuo Chen
 
Intro to Rust from Applicative / NY Meetup
Intro to Rust from Applicative / NY MeetupIntro to Rust from Applicative / NY Meetup
Intro to Rust from Applicative / NY Meetupnikomatsakis
 
Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)nikomatsakis
 
java memory management & gc
java memory management & gcjava memory management & gc
java memory management & gcexsuns
 
Coding for multiple cores
Coding for multiple coresCoding for multiple cores
Coding for multiple coresLee Hanxue
 
Exploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelExploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelVitaly Nikolenko
 
Угадываем пароль за минуту
Угадываем пароль за минутуУгадываем пароль за минуту
Угадываем пароль за минутуPositive Hack Days
 
Lockless Programming GDC 09
Lockless Programming GDC 09Lockless Programming GDC 09
Lockless Programming GDC 09Lee Hanxue
 

Was ist angesagt? (20)

Kernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easyKernel Recipes 2019 - Formal modeling made easy
Kernel Recipes 2019 - Formal modeling made easy
 
Making a Process
Making a ProcessMaking a Process
Making a Process
 
Putting a Fork in Fork (Linux Process and Memory Management)
Putting a Fork in Fork (Linux Process and Memory Management)Putting a Fork in Fork (Linux Process and Memory Management)
Putting a Fork in Fork (Linux Process and Memory Management)
 
Class 1: What is an Operating System?
Class 1: What is an Operating System?Class 1: What is an Operating System?
Class 1: What is an Operating System?
 
Crossing into Kernel Space
Crossing into Kernel SpaceCrossing into Kernel Space
Crossing into Kernel Space
 
Scheduling in Linux and Web Servers
Scheduling in Linux and Web ServersScheduling in Linux and Web Servers
Scheduling in Linux and Web Servers
 
Virtual Memory (Making a Process)
Virtual Memory (Making a Process)Virtual Memory (Making a Process)
Virtual Memory (Making a Process)
 
Where destructors meet threads
Where destructors meet threadsWhere destructors meet threads
Where destructors meet threads
 
Scheduling
SchedulingScheduling
Scheduling
 
Intro to Rust from Applicative / NY Meetup
Intro to Rust from Applicative / NY MeetupIntro to Rust from Applicative / NY Meetup
Intro to Rust from Applicative / NY Meetup
 
Operating System Engineering Quiz
Operating System Engineering QuizOperating System Engineering Quiz
Operating System Engineering Quiz
 
Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)
 
java memory management & gc
java memory management & gcjava memory management & gc
java memory management & gc
 
Coding for multiple cores
Coding for multiple coresCoding for multiple cores
Coding for multiple cores
 
MyShell - English
MyShell - EnglishMyShell - English
MyShell - English
 
Meltdown & spectre
Meltdown & spectreMeltdown & spectre
Meltdown & spectre
 
Meltdown & Spectre
Meltdown & Spectre Meltdown & Spectre
Meltdown & Spectre
 
Exploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelExploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernel
 
Угадываем пароль за минуту
Угадываем пароль за минутуУгадываем пароль за минуту
Угадываем пароль за минуту
 
Lockless Programming GDC 09
Lockless Programming GDC 09Lockless Programming GDC 09
Lockless Programming GDC 09
 

Andere mochten auch

Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)David Evans
 
Inventing the Future
Inventing the FutureInventing the Future
Inventing the FutureDavid Evans
 
Flash! (Modern File Systems)
Flash! (Modern File Systems)Flash! (Modern File Systems)
Flash! (Modern File Systems)David Evans
 
SSL Failing, Sharing, and Scheduling
SSL Failing, Sharing, and SchedulingSSL Failing, Sharing, and Scheduling
SSL Failing, Sharing, and SchedulingDavid Evans
 
Gash Has No Privileges
Gash Has No PrivilegesGash Has No Privileges
Gash Has No PrivilegesDavid Evans
 
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)David Evans
 
Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...
Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...
Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...David Evans
 
What the &~#@&lt;!? (Memory Management in Rust)
What the &~#@&lt;!? (Memory Management in Rust)What the &~#@&lt;!? (Memory Management in Rust)
What the &~#@&lt;!? (Memory Management in Rust)David Evans
 
What the &~#@&lt;!? (Pointers in Rust)
What the &~#@&lt;!? (Pointers in Rust)What the &~#@&lt;!? (Pointers in Rust)
What the &~#@&lt;!? (Pointers in Rust)David Evans
 
Servo: The parallel web engine
Servo: The parallel web engineServo: The parallel web engine
Servo: The parallel web engineBruno Abinader
 
Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!Kel Cecil
 
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOME
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOMERuby is Awesome and Rust is Awesome and Building a Game in Both is AWESOME
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOMEJulien Fitzpatrick
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 pramode_ce
 
Type-Directed TDD in Rust: a case study using FizzBuzz
Type-Directed TDD in Rust: a case study using FizzBuzzType-Directed TDD in Rust: a case study using FizzBuzz
Type-Directed TDD in Rust: a case study using FizzBuzzFranklin Chen
 
RUSTing -- Partially Ordered Rust Programming Ruminations
RUSTing -- Partially Ordered Rust Programming RuminationsRUSTing -- Partially Ordered Rust Programming Ruminations
RUSTing -- Partially Ordered Rust Programming RuminationsAngelo Corsaro
 
Rust: Unlocking Systems Programming
Rust: Unlocking Systems ProgrammingRust: Unlocking Systems Programming
Rust: Unlocking Systems ProgrammingC4Media
 

Andere mochten auch (19)

Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)
 
Storage
StorageStorage
Storage
 
The Internet
The InternetThe Internet
The Internet
 
Inventing the Future
Inventing the FutureInventing the Future
Inventing the Future
 
Flash! (Modern File Systems)
Flash! (Modern File Systems)Flash! (Modern File Systems)
Flash! (Modern File Systems)
 
SSL Failing, Sharing, and Scheduling
SSL Failing, Sharing, and SchedulingSSL Failing, Sharing, and Scheduling
SSL Failing, Sharing, and Scheduling
 
Gash Has No Privileges
Gash Has No PrivilegesGash Has No Privileges
Gash Has No Privileges
 
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
 
Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...
Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...
Smarter Scheduling (Priorities, Preemptive Priority Scheduling, Lottery and S...
 
What the &~#@&lt;!? (Memory Management in Rust)
What the &~#@&lt;!? (Memory Management in Rust)What the &~#@&lt;!? (Memory Management in Rust)
What the &~#@&lt;!? (Memory Management in Rust)
 
OOP in Rust
OOP in RustOOP in Rust
OOP in Rust
 
What the &~#@&lt;!? (Pointers in Rust)
What the &~#@&lt;!? (Pointers in Rust)What the &~#@&lt;!? (Pointers in Rust)
What the &~#@&lt;!? (Pointers in Rust)
 
Servo: The parallel web engine
Servo: The parallel web engineServo: The parallel web engine
Servo: The parallel web engine
 
Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!Hey! There's OCaml in my Rust!
Hey! There's OCaml in my Rust!
 
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOME
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOMERuby is Awesome and Rust is Awesome and Building a Game in Both is AWESOME
Ruby is Awesome and Rust is Awesome and Building a Game in Both is AWESOME
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017
 
Type-Directed TDD in Rust: a case study using FizzBuzz
Type-Directed TDD in Rust: a case study using FizzBuzzType-Directed TDD in Rust: a case study using FizzBuzz
Type-Directed TDD in Rust: a case study using FizzBuzz
 
RUSTing -- Partially Ordered Rust Programming Ruminations
RUSTing -- Partially Ordered Rust Programming RuminationsRUSTing -- Partially Ordered Rust Programming Ruminations
RUSTing -- Partially Ordered Rust Programming Ruminations
 
Rust: Unlocking Systems Programming
Rust: Unlocking Systems ProgrammingRust: Unlocking Systems Programming
Rust: Unlocking Systems Programming
 

Ähnlich wie Kernel-Level Programming: Entering Ring Naught

Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기Ji Hun Kim
 
Using browser() in R
Using browser() in RUsing browser() in R
Using browser() in RLeon Kim
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source codeAndrey Karpov
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source codePVS-Studio
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp fullVõ Hòa
 
Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6fisher.w.y
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory AnalysisMoabi.com
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesTatiana Al-Chueyr
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game EngineJohan Andersson
 
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...Positive Hack Days
 
6. processes and threads
6. processes and threads6. processes and threads
6. processes and threadsMarian Marinov
 
Do snow.rwn
Do snow.rwnDo snow.rwn
Do snow.rwnARUN DN
 
20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugsComputer Science Club
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyRay Song
 
44 con slides
44 con slides44 con slides
44 con slidesgeeksec80
 
44 con slides (1)
44 con slides (1)44 con slides (1)
44 con slides (1)geeksec80
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory AnalysisMoabi.com
 

Ähnlich wie Kernel-Level Programming: Entering Ring Naught (20)

Programar para GPUs
Programar para GPUsProgramar para GPUs
Programar para GPUs
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
 
Using browser() in R
Using browser() in RUsing browser() in R
Using browser() in R
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
 
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
 
6. processes and threads
6. processes and threads6. processes and threads
6. processes and threads
 
Do snow.rwn
Do snow.rwnDo snow.rwn
Do snow.rwn
 
20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs20140531 serebryany lecture02_find_scary_cpp_bugs
20140531 serebryany lecture02_find_scary_cpp_bugs
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCy
 
44 con slides
44 con slides44 con slides
44 con slides
 
44 con slides (1)
44 con slides (1)44 con slides (1)
44 con slides (1)
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
 
Return Oriented Programming (ROP) Based Exploits - Part I
Return Oriented Programming  (ROP) Based Exploits  - Part IReturn Oriented Programming  (ROP) Based Exploits  - Part I
Return Oriented Programming (ROP) Based Exploits - Part I
 

Mehr von David Evans

Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!David Evans
 
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksTrick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksDavid Evans
 
Hidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeHidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeDavid Evans
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in BitcoinDavid Evans
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm ConfirmationsDavid Evans
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting TransactionsDavid Evans
 
How to Live in Paradise
How to Live in ParadiseHow to Live in Paradise
How to Live in ParadiseDavid Evans
 
Mining Economics
Mining EconomicsMining Economics
Mining EconomicsDavid Evans
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More ParanoidDavid Evans
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key SignaturesDavid Evans
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to CryptographyDavid Evans
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?David Evans
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the MassesDavid Evans
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of ReserveDavid Evans
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!David Evans
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinDavid Evans
 

Mehr von David Evans (20)

Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!
 
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksTrick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
 
Hidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeHidden Services, Zero Knowledge
Hidden Services, Zero Knowledge
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in Bitcoin
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm Confirmations
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting Transactions
 
How to Live in Paradise
How to Live in ParadiseHow to Live in Paradise
How to Live in Paradise
 
Bitcoin Script
Bitcoin ScriptBitcoin Script
Bitcoin Script
 
Mining Economics
Mining EconomicsMining Economics
Mining Economics
 
Mining
MiningMining
Mining
 
The Blockchain
The BlockchainThe Blockchain
The Blockchain
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More Paranoid
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the Masses
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of Reserve
 
Silk Road
Silk RoadSilk Road
Silk Road
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, Permacoin
 

Kürzlich hochgeladen

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Kürzlich hochgeladen (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Kernel-Level Programming: Entering Ring Naught

  • 2. Plan for Today Review (Exam 1 Questions) Milestones in Computing Building a Kernel 1 Reminder: PS4 (part 1) is out now. If you want to have more time to work on your project idea instead of PS4, need to let me know this week. Everyone should have received an email with the recorded results for PS2, PS3, and Exam 1.
  • 3. No Exam 2, 30 Final Instead, 2 Another Assignment, 1 March 20- 21, 14 March 25- 27, 37 Near End of Semester, 11 Took it already!, 1 Exam2 2
  • 4. No Exam 2, 30 Final Instead, 2 Another Assignment, 1 March 20- 21, 14 March 25- 27, 37 Near End of Semester, 11 Took it already!, 1 Exam2 3 Exam 2 will be out March 25 and due March 27 (12:25pm)
  • 5. Talk After Class Today! 4 Cyber War, Cyber Peace, Stones, and Glass Houses Gary McGraw, CTO Cigital 2:00 PM Rice Hall 130
  • 6. 5
  • 7. 6 “What is significant about the bakery algorithm is that it implements mutual exclusion without relying on any lower-level mutual exclusion. Assuming that reads and writes of a memory location are atomic actions, as previous mutual exclusion algorithms had done, is tantamount to assuming mutually exclusive access to the location. So a mutual exclusion algorithm that assumes atomic reads and writes is assuming lower-level mutual exclusion. Such an algorithm cannot really be said to solve the mutual exclusion problem. Before the bakery algorithm, people believed that the mutual exclusion problem was unsolvable--that you could implement mutual exclusion only by using lower-level mutual exclusion.”Communications of the ACM, August 1974 (2 pages) We will explore this next Tuesday!
  • 8. What are the advantages/disadvantages of hardware-based memory isolation over software-based memory isolation? 7
  • 10. 9 Hardware Memory Isolation STR r0, [r1] a[i] = x compiler assembler rustc as 0100101101011… mem.rs mem
  • 11. 10 Hardware Memory Isolation STR r0, [r1] a[i] = x compiler assembler rustc as 0100101101011… mem.rs mem process running code gash> mem loader
  • 12. 11 Hardware Memory Isolation STR r0, [r1] a[i] = x WRITE 0x57283952, 0x413024 LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory compiler assembler rustc as 0100101101011… mem.rs mem process running code gash> mem loader
  • 13. 12 Hardware Memory Isolation STR r0, [r1] a[i] = x WRITE 0x57283952, 0x413024 compiler assembler rustc as 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory FAIL!
  • 15. 14
  • 16. 15 Software-Based Memory Isolation? STR r0, [r1] a[i] = x WRITE 0x57283952, 0x413024 compiler assembler rustc as 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory FAIL!
  • 17. 16 Software-Based Memory Isolation …lots of code… STR r0, [r1] a[i] = x WRITE 0x57283952, 0x413024 compiler assembler rustc 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory
  • 18. 17 Software-Based Memory Isolation …lots of code… STR r0, [r1] a[i] = x WRITE 0x57283952, 0x413024 compiler assembler rustc 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory fn main() { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; } > rustc oob.rs > ./oob task '<main>' failed at 'index out of bounds: the len is 4 but the index is 6', oob.rs:5
  • 19. 18 rustc -S oob.rsLtmp4: … movq $6, -40(%rbp) movq -40(%rbp), %rcx cmpq $4, %rcx setae %dl testb $1, %dl movq %rdi, -48(%rbp) movq %rax, -56(%rbp) movq %rcx, -64(%rbp) jne LBB0_2 movq -56(%rbp), %rax movq -64(%rbp), %rcx movq $7, (%rax,%rcx,8) addq $64, %rsp popq %rbp ret LBB0_2: leaq _str1253(%rip), %rsi movabsq $5, %rdx movabsq $4, %r8 movq -64(%rbp), %rcx callq __ZN8unstable4lang17fail_bounds_check19h71a9f1 .cfi_endproc
  • 20. 19 Software-Based Memory Isolation …lots of code… STR r0, [r1] a[i] = x jne LBB0_2 compiler assembler rustc 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory FAIL!
  • 21. 20 Software-Based Memory Isolation …lots of code… STR r0, [r1] a[i] = x jne LBB0_2 compiler assembler rustc 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory FAIL! What if you aren’t starting with source code in a type-safe language?
  • 22. 21 Software-Based Memory Isolation STR r0, [r1] a[i] = x jne LBB0_2 compiler assembler rustc 0100101101011… mem.rs mem process running code gash> mem loader LogicalAddress Segmentation Unit LinearAddress Paging Unit PhysicalAddress Memory FAIL!transformer / loader
  • 24. Which is more “expensive”? Hardware-Based Memory Isolation Transistors + wires OS sets up page permissions, loads programs Software-Based Memory Isolation Trusted compiler/loader Statically safe: no runtime cost! 23
  • 26. Hello World? 25 fn main() { println("Hello?"); }
  • 27. 1. What’s the difference between a programming language and an operating system? 26
  • 28. 27 Image: flickr cc: Ruben Alexander
  • 29. 28
  • 30. Which came first? • Early programming languages did not run on an Operating System – Turing’s language, Church’s Lambda Calculus – IPL/Lisp, FLOW-MATIC, etc. • Early operating systems were not written in programming languages 29
  • 32. Programming Language • Mostly a precise way for humans to describe programs • Provides abstractions of (abstract) machine resources • Associated programs like compilers translate into a program for machines to execute • Modern programming languages usually depend on an underlying OS Operating System • A program that runs on some hardware • Provides abstractions for (real) machine resources • Manages sharing of machine resources • Modern operating systems are mostly implemented in C (arguably a programming language) and assembly 31
  • 33. Kernel Programming in Rust 32 #[no_std]; fn main() { println("Hello?"); }
  • 34. Kernel Programming in Rust 33 #[no_std]; fn main() { println("Hello?"); } > rustc hello.rs hello.rs:4:5: 4:12 error: unresolved name `println`. hello.rs:4 println("Hello?"); ^~~~~~~ error: aborting due to previous error
  • 35. Printing is For The Weak! 34 #[no_std]; fn main() { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; }
  • 36. Main is For The Weak! 35 #[no_std]; fn main() { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; } > rustc oob1.rs error: requires `start` lang_item
  • 37. 36 #[no_std]; #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; }
  • 38. 37 #[no_std]; #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; } gash> rustc oob2.rs oob2.rs:4:1: 9:2 error: not all control paths return a value oob2.rs:4 fn main(_: int, _: **u8) -> int { oob2.rs:5 let mut a = [0, 1, 2, 3]; oob2.rs:6 let i = 6; oob2.rs:7 oob2.rs:8 a[i] = 7; oob2.rs:9 } error: aborting due to previous error
  • 39. 38 #[no_std]; #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; return 0; }
  • 40. 39 rustc -S oob.rsLtmp4: … movq $6, -40(%rbp) movq -40(%rbp), %rcx cmpq $4, %rcx setae %dl testb $1, %dl movq %rdi, -48(%rbp) movq %rax, -56(%rbp) movq %rcx, -64(%rbp) jne LBB0_2 movq -56(%rbp), %rax movq -64(%rbp), %rcx movq $7, (%rax,%rcx,8) addq $64, %rsp popq %rbp ret LBB0_2: leaq _str1253(%rip), %rsi movabsq $5, %rdx movabsq $4, %r8 movq -64(%rbp), %rcx callq __ZN8unstable4lang17fail_bounds_check19h71a9f1 .cfi_endproc
  • 41. 40 #[no_std]; #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; return 0; } bash-3.2$ rustc oob3.rs oob3.rs:8:5: 8:8 error: requires `fail_bounds_check` lang_item oob3.rs:8 a[i] = 7; ^~~
  • 42. 41 #[no_std]; extern "rust-intrinsic" { fn abort() -> !; } #[no_mangle] pub extern fn rust_stack_exhausted() { unsafe { abort() } } #[lang="fail_bounds_check"] pub fn fail_bounds_check(_: *i8, _: uint, _: uint, _: uint) { unsafe { abort() } } #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; return 0; }
  • 43. 42 #[no_std]; extern "rust-intrinsic" { fn abort() -> !; } #[no_mangle] pub extern fn rust_stack_exhausted() { unsafe { abort() } } #[lang="fail_bounds_check"] pub fn fail_bounds_check(_: *i8, _: uint, _: uint, _: uint) { unsafe { abort() } } #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 6; a[i] = 7; return 0; } gash> rustc oob4.rs gash> ./oob4 Illegal instruction: 4
  • 44. 43 #[no_std]; extern "rust-intrinsic" { fn abort() -> !; } #[no_mangle] pub extern fn rust_stack_exhausted() { unsafe { abort() } } #[lang="fail_bounds_check"] pub fn fail_bounds_check(_: *i8, _: uint, _: uint, _: uint) { unsafe { abort() } } #[start] fn main(_: int, _: **u8) -> int { let mut a = [0, 1, 2, 3]; let i = 2; a[i] = 7; return 0; } gash> rustc oob5.rs gash> ./oob5 gash>
  • 45. IronKernel 44 Kevin Broderick, Alex Lamana, Zeming Lin, John Stevans, Wil Thomason
  • 46. Building a Kernel 45 #[no_std] Remove everything from Rust that depends on OS: everything that uses system calls rust-core Library that doesn’t depend on OS.
  • 47. // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use fail::abort; use mem::replace; pub enum Option<T> { Some(T), None } impl<T> Option<T> { /// Returns true if the option contains a `Some` value pub fn is_some(&self) -> bool { match *self { Some(_) => true, None => false } } core/option.rs 46 /// Convert from `Option<T>` to `Option<&T>` pub fn as_ref<'a>(&'a self) -> Option<&'a T> { match *self { Some(ref x) => Some(x), None => None } } /// Convert from `Option<T>` to `Option<&mut T>` pub fn as_mut<'a>(&'a mut self) -> Option<&'a mut T> { match *self { Some(ref mut x) => Some(x), None => None } } /// Return the value in an `Option` or call `abort` if it is `None`. pub fn get(self) -> T { match self { Some(x) => x, None => abort() } } /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value. pub fn map<U>(self, f: |T| -> U) -> Option<U> { match self { Some(x) => Some(f(x)), None => None } } /// Applies a function to the contained value or returns a default. pub fn map_or<U>(self, def: U, f: |T| -> U) -> U { match self { None => def, Some(t) => f(t) } } /// Take the value out of the option, leaving a `None` in its place. #[inline(always)] pub fn take(&mut self) -> Option<T> { replace(self, None) } } Why does normal Option type need OS?
  • 49. Building a Kernel 48 #[no_std] Remove everything from Rust that depends on OS: everything that uses system calls rust-core Library that doesn’t depend on OS. rustboot
  • 50. 49
  • 51. 50
  • 52. 51
  • 53. Building a Kernel 52 #[no_std] Remove everything from Rust that depends on OS: everything that uses system calls rust-core Library that doesn’t depend on OS. rustboot Boot! IronKernel 32-bit ARM OS kernel that can print text on the screen (in many colors!), handle keyboard input (as long as you don’t press any “dangerous” keys
  • 55. Kernel Programming 54 Development Machine (Ubuntu 64-bit x86 Linux) editors, file system, networ k, compilers Target Machine (32-bit ARM)
  • 56. Kernel Programming 55 Development Machine (Ubuntu 64-bit x86 Linux) editors, file system, networ k, cross-compilers Target Machine (32-bit ARM) ARM binary
  • 57. Kernel Programming 56 Development Machine (Ubuntu 64-bit x86 Linux) editors, file system, networ k, cross-compilers QEMU: Emulator (32-bit ARM) ARM binary
  • 58. 57 How the kernel is built: > rustc --emit-llvm mod.rs > llc -march=arm -mcpu=arm926ej-s mod.bc > arm-none-eabi-as mod.as > objcopy mod.o … mod.rs mod.bc mod.s mod.o kernel.bin rustc llc arm-none-eabi-as objcopyassembler naming convention: [processor]-[os]-[application binary interface]
  • 59. 58 How the kernel is built: > rustc --emit-llvm mod.rs > llc -march=arm -mcpu=arm926ej-s mod.bc > arm-none-eabi-as mod.as > objcopy mod.o … mod.rs mod.bc mod.s mod.o kernel.bin rustc llc arm-none-eabi-as objcopyassembler naming convention: [processor]-[os]-[application binary interface] Easy way: make run
  • 61. 60 *((addr + (i * 4)) as * mut u32) = val
  • 62. 61 Reminder: stay for Gary McGraw talk! Form PS4 Teams while you are waiting for Gary’s talk! A PS4 team can be any 3 people.