OSFC 2018 - coreboot rompayload | Ron Minnich

Open Source Firmware Conference
2 Oct 201827:27

Summary

TLDRIn this tech talk, the speaker delves into the concept of RAM payloads in firmware, contrasting them with the traditional ROM stage. They recount the history of Linux BIOS and the evolution of the RAM stage, which was initially designed to overcome limitations in Linux. The speaker argues for the potential redundancy of the RAM stage in modern systems, especially with advancements in Linux's capabilities. They also discuss the move towards eliminating runtime firmware services due to trust issues and advocate for a simplified boot process, demonstrating a live test of a RAM payload in coreboot, highlighting its efficiency and potential for future boot systems.

Takeaways

  • 😀 The speaker experimented with a 'random payload' approach, inspired by Trammell's picture of Vincent, which involves loading a payload directly from the ROM stage instead of using a RAM stage.
  • 📝 The speaker emphasized the importance of having an outline for a talk, but also the need to go beyond a basic outline for better informativeness.
  • 🔍 The RAM stage's function is to discover, allocate, configure, and enable resources before booting, and it has been evolving since 2007 with the introduction of SMM (System Management Mode).
  • 🚫 The speaker expressed concerns about the trustworthiness of firmware, advocating for an 'air gap' approach where the firmware runs and then never communicates back, to avoid potential security issues.
  • 🛠️ The speaker discussed the history and evolution of the ROM stage and RAM stage, including the initial challenges with Linux and the development of the device model in coreboot.
  • 🔧 The speaker shared personal anecdotes about working with Linux BIOS and the evolution of the Linux kernel, including issues with PCI device enabling and the incorporation of PCI enumeration code.
  • 🔄 The speaker questioned the necessity of the RAM stage given the growing capabilities of Linux, suggesting that in some cases, the RAM stage might be redundant.
  • 💡 The idea of a RAM payload was presented as a potential simplification of the boot process, where the payload is loaded directly from ROM without the need for a RAM stage.
  • 🔗 The speaker touched on the complexities and potential security risks of UEFI (Unified Extensible Firmware Interface) and the desire to move towards a more streamlined boot process.
  • 🛑 The speaker critiqued the current signing models in firmware, arguing for more user control over their machines and against vendor lock-in.
  • 🔄 The speaker concluded with a demo of the RAM payload in action, showing its practical application and performance, and opened the floor for questions and further discussion.

Q & A

  • What is the main topic of the speaker's presentation?

    -The speaker is discussing the concept and implications of RAM payloads in the context of firmware and operating systems, particularly focusing on their evolution, necessity, and potential redundancy with advancements in technology.

  • What does the speaker mean by 'random payload'?

    -A 'random payload' in this context refers to a payload loaded from the ROM stage instead of loading a RAM stage, which is a departure from the traditional method of loading payloads for booting up systems.

  • What is the purpose of the RAM stage according to the speaker?

    -The RAM stage is designed to discover, allocate, configure, and enable resources before booting the system. It also serves as a means of communicating this information to the payload.

  • Why did the speaker attempt to implement a RAM payload?

    -The speaker was inspired by Trammell's picture of Vincent and wanted to explore whether the RAM payload method could work effectively, although it didn't work as intended due to banding issues.

  • What is the speaker's view on the necessity of the RAM stage in modern systems?

    -The speaker questions the necessity of the RAM stage, suggesting that with the growth in capabilities of operating systems like Linux, the functions traditionally performed by the RAM stage might be redundant.

  • What is the speaker's stance on the use of SMM (System Management Mode)?

    -The speaker expresses a negative view of SMM, stating that it was considered a bad idea even in the early 2000s and that they would prefer not to have it running on systems due to security concerns.

  • What is the speaker's opinion on the current state of firmware in systems?

    -The speaker criticizes the current state of firmware, describing it as a large, complex operating system that often contains vulnerabilities and is a source of vendor lock-in.

  • What is the speaker's suggestion for handling firmware updates?

    -The speaker suggests that instead of relying on firmware updates that require reflashing, systems should allow for the kernel to supply M mode code, which can be updated simply by rebooting.

  • What is the 'air gap' concept mentioned by the speaker?

    -The 'air gap' concept refers to a design choice where components are loaded by other components without any communication back, which is intended to prevent trust issues with untrusted firmware.

  • What is the speaker's view on the future of firmware and operating system interactions?

    -The speaker advocates for a future where operating systems have more control over their environment, including the ability to supply their own M mode code, rather than relying on potentially untrustworthy firmware.

  • What is the speaker's final recommendation regarding the RAM stage?

    -The speaker recommends revisiting the necessity of the RAM stage in light of modern capabilities of operating systems and suggests that direct payload loading from the ROM stage could be a viable alternative.

Outlines

00:00

🔧 Experimenting with RAM Payloads and BIOS Limitations

The speaker begins by expressing their initial attempt to emulate Trammell's work on recursion, which didn't go as planned due to banding issues. They discuss the importance of having an outline for a talk and proceed to explain the concept of a RAM payload, contrasting it with the traditional ROM stage. The speaker clarifies that a RAM payload is loaded directly from the ROM stage, bypassing the usual RAM stage process. They delve into the history and evolution of the RAM stage, its purpose in discovering and allocating resources before booting, and the introduction of untimed firmware SMM. The speaker also reflects on the early days of Linux BIOS and the challenges faced in integrating Linux as a RAM stage, including issues with SDRAM and PCI device enabling.

05:00

🛠️ The Evolution of Linux and the RAM Stage Intersection

This paragraph delves into the evolution of both Linux and the RAM stage, questioning the necessity of the RAM stage given Linux's growing capabilities. The speaker discusses the early risk ports that lacked a RAM stage and expresses concern over the direction of the RISC-V community, which seems to be expanding the RAM stage based on x86 models. They argue against blindly following x86 practices and emphasize the need to critically assess the role of the RAM stage in different systems. The speaker also touches on the desire to move away from firmware services at runtime due to trust issues and the inefficiencies they introduce.

10:03

🛡️ Trust Issues with Firmware and the Case for Kernel-Controlled M Mode

The speaker addresses the trustworthiness of firmware, advocating for control of the machine by its owner. They criticize the current model where vendor keys are fused and immutable, creating a dependency on OEMs for updates. The speaker prefers the Chromebook model, where the owner has the ability to change keys. They also discuss the inefficiencies and potential for bugs in firmware, suggesting that the kernel should supply M mode code instead of relying on firmware, allowing for easier updates and optimizations.

15:04

🔄 The Challenge of Firmware as a Service Layer and the RAM Payload

The speaker continues to critique the reliance on firmware, likening it to a complex operating system with potential for exploits and inefficiencies. They recount the history of firmware's growth and its role in vendor lock-in, expressing a preference for a model where the kernel supplies M mode code, allowing for easier updates and less dependency on firmware. The speaker also discusses the concept of an air gap, where the system is designed to not trust firmware, and the importance of this in avoiding firmware-related issues.

20:06

🚀 Demonstrating RAM Payloads and the Future of Coreboot

The speaker presents a live demonstration of a RAM payload in Coreboot, highlighting the process and its outcomes. They discuss the changes made to the payload, including the addition of 'Linux check' to ensure a smooth transition for Linux. The speaker also addresses the issues with the ROM stage in QEMU and the modifications made to the boot process. They conclude by expressing optimism about the potential of RAM payloads in Coreboot and other architectures, including UEFI.

25:08

🤝 Seeking Collaboration and Input on Coreboot Development

In the final paragraph, the speaker opens the floor for questions and discusses the ongoing work with RAM payloads and Coreboot. They express a desire for collaboration, particularly for testing on real boards and code reviews. The speaker also shares their thoughts on the potential of RAM payloads in the context of UEFI and the importance of avoiding reliance on firmware services. They invite others to contribute to the project and engage in discussions about the future of firmware and boot processes.

Mindmap

Keywords

💡ROM stage

ROM stage refers to the Read-Only Memory stage, which is the initial stage of a computer's boot process where the system's firmware begins execution. In the context of the video, the ROM stage is crucial for starting the boot process and can be used to load a payload directly, bypassing the need for a RAM stage in some cases. The script discusses experimenting with the ROM stage to load Linux directly, which is a departure from the traditional use of the ROM stage to load a RAM stage.

💡RAM stage

RAM stage is the phase in a computer's boot process where the system's firmware transitions from the ROM stage and begins to execute code from Random Access Memory. It is designed to discover, allocate, configure, and enable resources before the operating system boots. The video's theme revolves around questioning the necessity of the RAM stage, especially when the capabilities of modern operating systems like Linux can overlap with those of the RAM stage.

💡Payload

In the script, a payload refers to a piece of software that is loaded during the boot process. Traditionally, the ROM stage loads a payload into RAM, which then takes over the boot process. The video discusses an alternative approach where the payload is loaded directly from the ROM stage, bypassing the RAM stage, which can simplify the boot process and reduce reliance on firmware.

💡Firmware

Firmware is the low-level software that controls a computer's hardware during the boot process and other critical functions. The video discusses the limitations and potential security risks associated with firmware, advocating for a reduction in reliance on firmware services post-boot and a move towards more direct control by the operating system, such as Linux.

💡UEFI

UEFI, or Unified Extensible Firmware Interface, is a modern firmware interface that replaces the traditional BIOS. It is designed to provide more features and security compared to older systems. The script mentions UEFI in the context of moving away from binary blobs and towards a cleaner boot process, aiming to simplify the transition from firmware to the operating system.

💡Coreboot

Coreboot is an open-source firmware project aimed at replacing proprietary BIOS/UEFI firmware with a lightweight and customizable alternative. The video discusses experiments and developments within the coreboot project, particularly around the concept of RAM payloads and the potential for direct payload loading from the ROM stage.

💡Linux

Linux is an open-source operating system kernel that is widely used in various computing environments. The video discusses the evolution of Linux and its capabilities, which have grown to the point where it can potentially perform some of the tasks traditionally handled by the RAM stage, leading to a reevaluation of the necessity of the RAM stage in the boot process.

💡SMM

SMM, or System Management Mode, is a protected mode of operation in x86 processors that allows for out-of-band management of the system. The script mentions SMM as a feature that has been historically included in firmware but is now being questioned for its necessity and security implications, with the speaker advocating for its removal or reduction in modern systems.

💡ACPI

ACPI, or Advanced Configuration and Power Interface, is a standard that defines power and configuration management interfaces for computers. The video mentions ACPI in the context of its potential as an exploit vector and the historical reluctance to integrate it with Linux BIOS, reflecting concerns about security and complexity.

💡Self-loader

A self-loader in the context of the video refers to a mechanism within the ROM or RAM stage that is capable of loading the next stage of the boot process without external assistance. The script discusses the implementation of a self-loader in the ROM stage, which simplifies the boot process and reduces dependencies.

💡Init Ram FS

Init Ram FS, or Initial RAM File System, is a temporary root file system that is loaded into memory during the boot process. The video discusses the potential for eliminating the need for an Init Ram FS by loading the operating system directly from the ROM stage, which is part of the broader theme of streamlining the boot process.

Highlights

Introduction to the concept of RAM payload and its evolution over time in firmware.

Explanation of the original purpose of the RAM stage in firmware.

Discussion on the implementation of untimed firmware SMM or S3 Linux files since 2007.

The speaker's personal experience with the early days of Linux BIOS and the challenges faced.

Historical context of the Linux kernel size compared to the average binary size on GitHub.

The attempt to use Linux as the RAM stage in 1999 and the issues encountered.

The evolution of the device model in Linux and its relation to the RAM stage.

Concerns about the growth of the RAM stage in the RISC-V community and its potential pitfalls.

The idea of eliminating the RAM stage and transitioning directly to the payload.

The current state of UEFI and the desire to streamline the boot process.

The concept of an 'air gap' in firmware to prevent trust issues with firmware.

Critique of the current model of firmware signing and the need for change.

The importance of having control over the machine one has paid for.

The speaker's perspective on the inefficiency and risks associated with firmware.

The proposal to let the Linux kernel supply M mode code instead of firmware.

The potential for RAM payloads to simplify the boot process and reduce reliance on firmware.

The demo of the RAM payload in action and its performance comparison with the standard RAM stage.

Open invitation for collaboration and testing of the RAM payload concept on various boards.

Transcripts

play00:00

[Music]

play00:04

give it up for a minute

play00:07

[Applause]

play00:11

so I got a little jealous of trammels

play00:14

picture of Vincent so I was trying her

play00:18

to this recursion thing and it didn't

play00:19

quite work as you can see with the

play00:21

banding yeah so anyway Ram payloads so

play00:26

they always tell you if you do a talk

play00:29

you need to have an outline so I did an

play00:31

outline there so and then I thought

play00:36

that's not very very informative so you

play00:38

know I did a slightly more of an outline

play00:41

so I'm gonna talk about what a Ram

play00:43

payload is and why you would do it and

play00:45

how it is done so I am NOT trying to

play00:50

claim here that this is something you

play00:52

would do on every platform mainly I'm

play00:55

trying to say it's something that might

play00:56

be useful on some platforms so what's

play01:00

the random payload I mean it's kind of

play01:01

simple it's just a payload loaded from

play01:03

the ROM stage instead of loading a Ram

play01:05

stage you just load the payload from the

play01:06

rom stage and then that begs the

play01:09

question because well what is a ram

play01:11

stage and a bunch of you in here know

play01:15

more about what it is than I do but I'm

play01:17

just gonna do my simple definition the

play01:20

function of the RAM stage is to discover

play01:21

allocate configure and enable resources

play01:23

roughly before booting I left one thing

play01:27

out have some means of communicating the

play01:31

information to the payload it can and

play01:35

this is more recent right so the first

play01:37

eight years this wasn't a thing but

play01:39

since 2007 or so it's been a thing which

play01:41

is implementer untimed firmware SMM or

play01:44

s3 Linux files would speak this began as

play01:47

originally didn't do that because it ran

play01:50

on supercomputers and I run on

play01:51

supercomputers in places that we

play01:53

absolutely did not ever want to have SMM

play01:55

running I think even as early as 2000 we

play01:59

kind of knew SMM was a very bad thing to

play02:04

put it lightly a the RAM stage is small

play02:06

in some systems and large on others and

play02:08

so then you know some people say to me

play02:10

sometimes oh wait a minute Linux does

play02:12

that right

play02:13

next us all that discover blah blah blah

play02:15

stuff so why aren't you doing it with

play02:17

Linux and that kind of gets back to the

play02:20

beginning and we actually never planned

play02:22

on a ramp stage in the beginning in the

play02:24

beginning actually Linux was the thing

play02:26

we loaded so here's the original ROM

play02:29

stage for Linux BIOS which was actually

play02:33

completely wrong because between the

play02:35

time I stopped working with PCI card

play02:37

design and I got back in the pcs again

play02:39

this thing called SDRAM happened which

play02:42

you know I had not a clue about so for

play02:45

what it's worth when I started this

play02:46

project I didn't have the faintest idea

play02:47

what I was doing and it somehow worked

play02:50

out so anyway so that's the first

play02:52

totally ridiculous rom stage that didn't

play02:54

work but you know okay fine that's the

play02:57

wrong stage let's pretend we got SDRAM

play02:59

working why don't we do Linux is the RAM

play03:01

stage in the first place well it

play03:03

actually turns out we did in 1999 I did

play03:06

it with Linux 2.2 didn't work get into

play03:09

that in a second interesting thing I

play03:11

clicked looked at all the binaries so

play03:12

the FS Peas on github and the average

play03:15

the 450k roughly which is bigger than

play03:19

the Linux kernel that we were putting in

play03:20

flash back then kind of a surprise

play03:24

so here's the problem I kind of stumbled

play03:27

my way through the SDRAM in it and

play03:28

finally got that working and stumbled my

play03:30

way through a bunch of early linux

play03:31

startup and now I plugged in and ie the

play03:34

IDE device and I got this far and then

play03:36

it said device disabled BIOS and I

play03:39

thought I can't be right I am the BIOS

play03:41

what did I do that I didn't know about

play03:43

did I kick myself in the back or

play03:45

something and and the answer was no we

play03:47

didn't do something behind her back we

play03:49

failed to do something and Linux back

play03:51

then interpreted not enabled as disabled

play03:54

in critical places so and here's the

play03:58

critical place in tune I to ID PCI type

play04:01

see there's this loop across the base

play04:03

address registers and if any one of them

play04:05

was 0 would just say oh dear me the BIOS

play04:08

has just disabled the IDE PCI device

play04:10

which of course we haven't done but we

play04:12

hadn't enabled it and then it all just

play04:14

you know it went south at that point so

play04:19

Linux 2.2 couldn't do it in 2000 and so

play04:23

I kind of we were really staring to

play04:25

options in the face

play04:26

one day option was fixed Linux right fix

play04:29

Linux is PCI and probing and all that

play04:31

stuff to work correctly when there

play04:33

wasn't a BIOS I kind of ping some

play04:37

friends so binding the Linux community

play04:38

and they kind of came back with oh

play04:40

you're just weird so there's no need to

play04:43

fix this because it works for us you're

play04:44

the only person and it was literally

play04:46

true I was the only person on the world

play04:47

with that problem but you know

play04:49

nevertheless I was having it and in 1998

play04:51

I tried to get the ninety subsystem into

play04:54

Linux and that took eight years and I

play04:57

didn't know that in 1999 but they

play05:00

weren't quite as open as they are today

play05:01

and remember this is free get free bit

play05:03

get keep bit keeper right this is kind

play05:05

of like I think there were still

play05:06

shuffling tar files around I'm not sure

play05:08

so the second option was fix Linux files

play05:11

and I went was Plan B I grabbed the

play05:14

Linux file Linux PCI enumeration code

play05:17

and jammed it into Linux and things kind

play05:19

of worked and that became the ROM stage

play05:20

and the thing we know as a device model

play05:22

came in kind of envy v2 so well the work

play05:29

on Linux files started in the second

play05:30

millennium announced the third

play05:32

millennium so now we've been around for

play05:34

like a millennium it seems like a good

play05:36

time to think this through a little and

play05:38

and you know the RAM stage has grown

play05:40

over time from this simple PCI

play05:41

configurator to a lot more stuff but

play05:43

Linux has similarly grown in in

play05:46

capability and they can do a lot more of

play05:47

what the RAM stage does so the question

play05:51

is there you can think of an

play05:52

intersection pointing capabilities

play05:54

between what Linux knows how to do it

play05:55

the RAM stage does and a question is you

play05:58

know do we need the RAM stage it's the

play06:00

intersection of capabilities at a point

play06:02

where Linux could just do what the rain

play06:05

stage does today and part of what drove

play06:09

this is the FIR early risk five ports

play06:11

there was no RAM stage I mean the only

play06:13

thing the RAM stage showed in the

play06:14

earlier wrist fight for its is loads

play06:15

payload and I get a little worried

play06:19

sometimes because I see the risk five

play06:21

RAM stage and I got to talk to Jonathan

play06:23

and Phillip about this but I see things

play06:25

growing in a risk five RAM stage almost

play06:27

because they're looking at the x86 as a

play06:30

model and that's not really convincing

play06:32

reason to do that right so I kind of

play06:35

worry a little bit about what I see

play06:36

happening because I saw this happen in a

play06:38

risk five community well if the x86

play06:40

does this we should do that so the x86

play06:42

has SMM well we'd better extend the

play06:45

privilege mode so we can make sure we

play06:46

can do a thing like s mm so you know

play06:48

sort of jumping into the mud pond there

play06:51

which is not always something you want

play06:53

to do and further in a lot of cases we

play06:56

don't want the things the RAM stage can

play06:57

do for us we don't want s mm we don't

play06:59

want s3 resume and we don't want to run

play07:01

times services at all on a lot of

play07:05

assistants we don't need the RAM stage

play07:06

to enumerate resources they're simple

play07:09

and hard-coded or they're PCI and we

play07:10

know how to enumerate PCI and you know

play07:13

SMP setup actually in the earliest days

play07:15

of Linux BIOS we did it in a kernel we

play07:17

did know SMP setup in Linux files until

play07:19

about I don't know a 2001 or two when we

play07:22

had to deal with the k7 which had a very

play07:24

odd style of SMP setup and we have other

play07:28

ways to provision things like API so you

play07:31

know if you look at the RAM stage a lot

play07:32

of the RAM stage is kind of there in

play07:34

some places arguably to support other

play07:35

parts of the RAM stage so that that's

play07:38

kind of the reason for looking at this

play07:40

so can we go right through the payload I

play07:42

did the experiment at the coreboot

play07:44

conference in Denver in 2015 and kind of

play07:47

convince myself that well Linux and

play07:49

Harvey actually could be loaded directly

play07:51

from the ROM stage the code wasn't great

play07:53

but it did the job and convinced me and

play07:55

this is actually what we're hoping to do

play07:57

in UEFI so here's UEFI today that's a

play08:03

lot of binary blobs right and and and

play08:05

there's scary stuff like there's this

play08:08

stuff right this happens when Linux is

play08:10

running what does it do the OS present a

play08:13

fact what does that do

play08:15

I don't know and there's just a lot of

play08:17

stuff in there that's read right for me

play08:19

blood-red and this is what we're working

play08:23

to we're not there but if we look at the

play08:26

SCC and PCI footprint in ROM it's about

play08:29

10% and what we want to do is go right

play08:33

from that last step which is the board

play08:35

in it right into Linux and flash and you

play08:38

saw your route this morning we won't

play08:40

have an init Ram FS containing you route

play08:42

with a net food or local boot and if we

play08:45

desperately need to run some UEFI driver

play08:47

we're gonna run that out of Linux so the

play08:50

big big red mess in the middle is gone

play08:52

completely

play08:54

and further we're doing we're putting in

play08:58

this concept of this air gap okay

play09:00

any idea is like we used to do in Linux

play09:02

BIOS that thing loads that thing and

play09:06

this thing never talks back and the

play09:09

reason is simple we don't trust firmware

play09:11

so that's a reasonable thing to not

play09:13

trust right they still in the last two

play09:15

years so the runtime is gone the OS

play09:17

president app is gone and this thing

play09:19

just runs and that's what we're trying

play09:22

to work to so it's simple rule if you

play09:27

don't underwear then you'll be owned by

play09:28

the firmware and we'd rather not be

play09:32

owned so by the way little digression

play09:40

the Linux BIOS Linux boot community is

play09:42

pretty big as Ryan showed we've had a

play09:45

lot of discussions about signing now

play09:49

we're stumbling right we're getting

play09:51

right close to the edge of my lack of

play09:52

understanding of some of these things

play09:53

but basically as I understand that the

play09:55

current model is that vendor keys get

play09:57

fused in to these fuses and then you can

play10:02

lock out any further attempts to change

play10:04

them that's just got to stop so that's

play10:08

got to get fixed the current model is

play10:10

just not acceptable and here's the

play10:12

simple reason one simple reason let's

play10:14

just say the odium sets the fuses and

play10:17

then here's a customer let's just i'll

play10:19

pick on facebook facebook is a customer

play10:22

if they want to do anything and get it

play10:24

signed they have to go back to the OEM

play10:25

okay fine now facebook sells nodes to

play10:28

john reese company for him to resell

play10:30

he's got to kind of go back around

play10:32

facebook to this company then this

play10:34

company buys them from john murray

play10:36

they've got to go back to that company

play10:38

if they ever change the firmware this is

play10:39

just not an acceptable situation this is

play10:42

one of those cases where I think chrome

play10:43

really completely got it right you get a

play10:46

Chromebook you want to change the keys

play10:47

you change the keys right cuz it's your

play10:49

you are the owner so I'm not even

play10:52

arguing here for open up all the source

play10:55

give us all the source GPL your source

play10:57

I'm really just arguing for give us

play10:59

control of the machine we paid money for

play11:00

that's a simple argument so if anybody's

play11:05

interested in having this discussion

play11:06

Friday or Saturday May

play11:08

we can sit down and talk about it but

play11:10

this has really got to change another

play11:12

thing that we keep getting into for the

play11:14

last 18 months on this project we've got

play11:16

to get from a point where we're doing

play11:18

docks by reverse engineering to docks

play11:22

and you may hear that theme a few more

play11:24

times in the next day anyway that air

play11:28

cough I mentioned is essential because

play11:29

it breaks this connection between you

play11:31

and the firm where you don't trust now

play11:34

it's not that people are bad or people

play11:38

are dumb it's that people make mistakes

play11:40

we all make mistakes right I make lots

play11:42

of mistakes and if you have a model

play11:44

where someone is going to create a blob

play11:46

and that blob will be bug free forever

play11:48

and they're gonna put it in this thing

play11:50

and are gonna sign it and you are stuck

play11:52

with that blob it's not a workable model

play11:54

right and and if that is the model and

play11:57

that is the model today then your best

play11:59

decision you can make is simply not to

play12:01

trust that once you're booted and that

play12:04

was the model from Linux files right we

play12:06

locked out SMN we heard a lot of stuff

play12:09

about it was impossible to create a

play12:10

server platform that didn't have SMM

play12:12

Linux Network shipped well over a

play12:14

hundred thousand nodes with no SMM they

play12:16

worked fine so um you know in 2000 the

play12:21

plan was no SMM and actually no acti

play12:23

because we knew a guy from AMD who had

play12:25

resigned from the ACPI committee because

play12:27

he told us it was just the exploit

play12:29

heaven and he didn't want anything to do

play12:30

with it

play12:31

we're not sure what to do about acne but

play12:33

oh well we did keep the air-gap for the

play12:36

first eight years of linux fast until

play12:38

laptops and you know i think we all know

play12:40

the story there if you're gonna do a

play12:42

laptop you're gonna do power management

play12:43

and the only model you've got there is

play12:45

SMM and act ii but what is it BIOS and I

play12:50

got to thinking about this and part of

play12:51

the reason is almost embarrassing I

play12:54

wrote my first firmware 40 years ago

play12:56

this year and it gives you some

play13:00

perspective so in 75 Garry killed well

play13:03

he's kind of the guy who invented the

play13:05

term BIOS for CPM you know you let it

play13:07

seep yet from a floppy and then in your

play13:09

1 kilo byte a EEPROM on your inside or

play13:12

out there right you had this little

play13:15

library any idea is CPM set the rules

play13:19

right

play13:19

CPM said if you're gonna run me

play13:21

you're gonna implement this to our

play13:24

specification so CPM ruled the roost

play13:27

right they they defined what that

play13:29

interface was then comes 1980 and it got

play13:35

a little weird because IBM released the

play13:37

PC and they actually released the source

play13:38

code to the BIOS but it was copyrighted

play13:40

but but this weird thing happened that

play13:43

it flipped right it's like the boat

play13:44

flipped over all of a sudden the thing

play13:48

that set the rules was the BIOS not some

play13:50

kernel and if that's the initial

play13:52

condition to where we are today where

play13:54

BIOS is set rules and we have to conform

play13:56

to those rules it wasn't that way in the

play13:58

first couple of years so where we are

play14:01

today is the firmware it's a 81 92 times

play14:04

larger it's a hardware adaptation layer

play14:06

it's a vendor lock-in tool I mean you

play14:08

can take your choice of these I tend to

play14:10

pick them all it's a complex operating

play14:12

system it's a large collection to build

play14:14

in Valle 'nor abilities and exploits

play14:15

it's a very inefficient way to access to

play14:17

services and in my opinion is something

play14:20

and everyone to use once you're booted

play14:21

that's the reason for what we're doing

play14:23

here and yet it keeps recurring so the

play14:29

risk 5 model is we've got the super end

play14:31

user modes and there's this thing called

play14:33

machine mode and machine mode is

play14:36

provided by the firmware vendor ok and

play14:39

you know do we have to do that actually

play14:41

we don't in the risk 5 this the one

play14:44

privileged mode the kernel could load M

play14:46

mode but we're all kind of working

play14:47

toward this model and you can see the

play14:49

patch is coming into coreboot where the

play14:52

firmware is going to provide the M mode

play14:54

and it's going to lock out the kernel

play14:55

from changing it that's called security

play14:57

and some planet or universe but it

play15:00

really doesn't have to be that way it's

play15:02

just the way we think about it because

play15:04

that's how we think about everything

play15:05

right firmware is permanent it has a

play15:09

higher privilege in anything it's the

play15:11

route of trust and the only problem with

play15:12

all that is this wrong because we can't

play15:14

trust it so we have an untrustable route

play15:17

of trust now I'm talking to one risk 5

play15:20

company that's working with someone I

play15:23

know in do-e they're not going to do

play15:25

that in their in their risk 5

play15:27

implementation the M mode code will be

play15:30

supplied by the kernel not the firmware

play15:34

so what's wrong with em mode firmware

play15:36

libraries well why would you trust it

play15:38

right it's gonna be written by the same

play15:40

people you know at these vendors off

play15:43

somewhere I'm not playing fingers that

play15:45

even the chipset guys somebody is gonna

play15:48

hack this thing up because we're trying

play15:49

to get a board out in schedule and

play15:51

they're gonna insert bugs that's what

play15:53

keeps happening so why on earth would

play15:56

you want to trust em mode stuff supplied

play15:58

by the kernel like I mean that firmware

play16:00

I can't think of a reason you know and

play16:02

how and when do you update if you if you

play16:03

have a bug in M mode you've got to

play16:05

reflash the firmware and all your

play16:06

machines if you supply the end mode with

play16:08

the kernel you reboot and you have the

play16:11

fixed end mode code so you know if you

play16:14

have an M mode security fix and the

play16:15

kernel supplies the code you reboot done

play16:17

you've you've updated your M mode code

play16:19

you didn't have to reflash for formants

play16:24

you know what's the API for these things

play16:26

it's always maximally paranoid okay if

play16:30

you write firmware that's going to be

play16:32

called by something you'd better assume

play16:34

the thing calling you is bug-ridden you

play16:37

can't trust it at all okay so you've got

play16:40

to do this a maximal saving of state to

play16:42

make sure that you don't get hurt and

play16:46

you know I've been here before on the

play16:48

IBM Blue Gene one of the last series in

play16:51

order to sort of preserve this IP layer

play16:53

they created this giant blob of a

play16:55

firmware if you wanted to send a packet

play16:56

on the IBM Blue Gene Taurus the idea was

play16:59

let's call this thing in firmware to

play17:01

send the packet for us okay well when

play17:03

you called that firmware on Blue Gene

play17:05

headed to a full TLB and cache flush and

play17:07

change the page table route so it was

play17:08

incredibly horrendously inefficient and

play17:10

you know all the guys who did kernels on

play17:12

Blue Gene including me we just ignored

play17:14

the firmware and we wrote our own code

play17:15

to send packets on the torus because we

play17:17

couldn't take that performance hit so

play17:20

you know I'm just not a big fan of you

play17:22

know firmware I call because it hasn't

play17:25

proved to really be a great idea and

play17:28

where is on risk 5 if the kernel is the

play17:30

end mode it can optimize calls to the

play17:32

end mode code so here's the slightly I I

play17:38

think this is the thing I expect to get

play17:40

beat up about kernel should should PI

play17:43

firmware services they need and this is

play17:45

kind of building on last year or I was

play17:46

showing that

play17:47

a Linux kernel could supply the SMM code

play17:50

and use it instead of the firmware

play17:51

supplied code if there's a firmware

play17:53

service mode in the CPU then let the

play17:56

kernel supply the code it runs that's

play17:58

real easy to do on risk 5 most of that

play18:00

stuff's to find in the core boot arch

play18:02

directories very easy to add that to

play18:04

Linux and have Linux set it up and you

play18:07

know this this policy though act 10

play18:09

sacks against this tendency people have

play18:12

like m-mode code or whatever code you

play18:14

want to call it you know people say oh

play18:16

we need this extra thing I know we'll

play18:18

just add another function mo then it

play18:20

grows without bound that's what we've

play18:21

seen happen that's why you know BIOS is

play18:24

on PCs or now eight megabytes of runtime

play18:26

stuff so I also think it would force a

play18:29

degree of your strength and what gets

play18:31

foot into n mode and it would also this

play18:35

one's important you know this stuff is

play18:37

always a lock in it's always a chance to

play18:41

lock you in to a given vendor because

play18:42

they supply some firmware library and

play18:44

the equivalent of M mode no one else

play18:46

supplies and now you've discovered

play18:47

you're dependent on it and you can't

play18:48

change vendors anyway back to the RAM

play18:51

payload that's my rant there's a ram

play18:55

payload for Concord org the rom stage

play18:58

loads the RAM payload if that fails goes

play19:01

directly to the RAM stage that's very

play19:03

handy for when things go wrong aside I

play19:07

think we need to I keep running across

play19:09

calls to run Ram stage that are followed

play19:12

by a die but Renton Ram stage never

play19:14

returns or didn't used to because it's

play19:16

got a die in and if it fails so we've

play19:18

got some kind of weirdness in the way we

play19:20

call Ram stage a lot of its historical

play19:22

and goes back I know some of that code

play19:23

is 10-15 years old

play19:25

anyway if the RAM payload works you get

play19:27

a prompt Brian talked about Linux kernel

play19:30

and you root this morning that's what

play19:32

the test I'm doing does which I'm going

play19:33

to show you in a minute so it changes 13

play19:37

files

play19:40

I added into the payload called Linux

play19:41

check which made my life way way easier

play19:44

Linux check is is intended to be a

play19:47

regression test that may grow over time

play19:48

and all NX check does is grovel just

play19:51

hunts around the machine looking for

play19:52

things that might cause trouble for

play19:53

Linux so it's a nice small piece of code

play19:56

it makes sure you have a console that

play19:58

the serial is set up that a number of

play20:00

memories is in the 8

play20:01

a table is greater than zero that's

play20:03

always nice Linux will panicked and

play20:05

visibly if that is zero so you know

play20:08

Linux jet gets handy for finding things

play20:11

that Linux will not tell you have

play20:13

happened

play20:15

and the only problem I've found so far

play20:17

once I got through some of this is that

play20:19

core boot ROM stage praying at least for

play20:21

me doesn't actually work in qmu anymore

play20:23

don't know why yet I added a ramp a load

play20:28

config bearable in CDF as in Ryan I've

play20:31

caught a call to run ramp rogue this is

play20:33

kind of boring stuff and I'm just quick

play20:34

on a quick run through it in the yard

play20:38

8250 i/o if config ramp payload is set

play20:41

then I call your fill lb which adds a

play20:43

table entry for the serial port and then

play20:47

in the you know I created this function

play20:49

run ramp rogue and that changes program

play20:51

loading todd h one weird thing i added

play20:54

my own compact boot mem write memory

play20:57

table because calling the standard one

play20:59

that runs on the ram staged rings in a

play21:01

lot of dependencies on tables that we

play21:02

don't actually create in the rom stage

play21:04

so it proved to be a lot simpler just to

play21:07

have a real truncated write memory table

play21:13

in the source leadcore boot table i just

play21:16

disabled a few things I enable CBM list

play21:19

and here's the one that's been a little

play21:20

controversial since I started doing this

play21:22

I've got a self loader for the ROM stage

play21:25

and it actually looks a lot like the

play21:26

Linux BIOS cv3 self loader it's a lot

play21:28

simpler than the RAM stage version

play21:30

because I don't have anything in RAM

play21:32

more or less right so I just called and

play21:34

and move it all to memory the push fact

play21:37

I got is we should only have one self

play21:39

loader my pushback on the pushback is

play21:42

self is a data structure format self

play21:46

loaders walked that data structure

play21:47

format and take certain actions similar

play21:50

to elf I don't see a problem with having

play21:52

to self loaders one being very complex

play21:54

and one being very simple so we can

play21:56

argue about that in the next few days

play21:57

when we're here I'm sure we will but

play21:59

that's my take on self loaders so that's

play22:05

it so far what about acti yeah what

play22:07

about efi we're not sure of that act ii

play22:08

Trammell's work on heads he actually was

play22:11

talking about loading a key from a file

play22:13

in unit ram FS rather than you

play22:15

one in the firmware because guess what

play22:16

we don't trust firmware so we're not

play22:19

quite sure what we want to do a lot acti

play22:22

it's just there have been issues in

play22:24

these active tables over the years and

play22:27

so I I don't think we'll want to quite

play22:30

do the full air gap with coreboot but

play22:32

never know so summary is random payloads

play22:37

were the original Linux files design the

play22:40

RAM stage was created to cover for these

play22:42

Linux limitations and they just haven't

play22:45

proven to be needed in all cases and

play22:47

this began when I was looking at the

play22:48

risk 5 and it continued when I was and

play22:50

then looking at UEFI when we were

play22:52

throwing away everything after the PGI

play22:54

and it seemed worth going back and

play22:56

taking a look at what we do in coreboot

play22:59

we don't want to use run time firmware

play23:02

services because we keep getting burned

play23:04

by them and that then makes the payloads

play23:06

look more sensible than ever and we're

play23:09

looking at developing them for a ufi

play23:10

that's of course just about well

play23:13

work-in-progress coreboot going to demo

play23:14

it and you boot on those processor

play23:16

architectures and I've forgotten I left

play23:19

off power because this works on power

play23:23

alright so let me do the demo so this is

play23:30

qmu you know normal dot rom you know

play23:34

standard Ram stage with the Linux

play23:36

payload and as I mentioned this is a

play23:39

basically this is the kernel that Ryan

play23:41

was talking about this morning along

play23:43

with you root as unit ram FS so way we

play23:47

go

play23:51

okay now ruff that prompt is the root

play23:53

shell prompt so you know this this

play23:56

varies and and I haven't done enough

play23:57

runs because I'm not a statistician but

play24:00

it kind of is like in above 5 type

play24:02

territory most of the time you can

play24:06

hammer me on my lack of statistical

play24:08

rigor that's fine and here's the RAM

play24:11

payload I mean even in queue of you you

play24:16

can see well same time don't like anyway

play24:21

generally this seems to be faster and

play24:23

it's not surprising because no way about

play24:24

it if you load the RAM if you load the

play24:27

colonel from the rum stage that's hard

play24:30

to see it being much slower than loading

play24:31

the RAM stage from the rum stage and

play24:33

then loading the colonel from the RAM

play24:34

stage so it actually works though and

play24:38

after i po the pci thing we have a

play24:41

command in your route called pci just

play24:43

prints the pci bus and you know you can

play24:45

do stuff like well show me your config

play24:47

space and the thing i notice here is if

play24:52

for those of you who really know pci

play24:54

well if you look at sort of config space

play24:57

for i don't think i've actually

play24:59

correctly configured that command

play25:01

register but it's and I don't think well

play25:04

I think that might be a bar there I'm

play25:05

not sure so I'm not entirely convinced

play25:07

that the PCI configuration is correct

play25:09

yet but I think it's fairly easy to deal

play25:13

with that kind of issue yeah so that's

play25:18

kind of it work in progress I think we

play25:24

could make this go and I think we can

play25:26

sort of dispense with what the RAM stage

play25:28

does and more importantly we're trying

play25:31

you know I'd kind of actually like this

play25:33

to be sort of competitive I you're gonna

play25:36

be surprised to hear me say this with

play25:37

UEFI boot and one way to get there is is

play25:40

not run the ramp stage and boy am i I'm

play25:43

also finishing really early so you're

play25:45

getting oh five minutes left

play25:46

oh I'm not finishing early it's time for

play25:48

questions yeah thank you very much yeah

play25:52

the round of applause thank you

play25:56

[Applause]

play25:58

so it's question-and-answer time so

play26:00

you're supplying the questions supplying

play26:03

the answers or so I've heard

play26:06

what's it who survives questions that's

play26:08

such a new thing for me here so bright

play26:17

so what do you need from other users who

play26:21

are interested in coreboot you know rom

play26:24

stage do you need tests already yes do

play26:27

you think it would work on real boards

play26:31

or would you be interested in tests or

play26:34

the Theresa I'm glad I'm here is because

play26:36

of the two-day hackathon I'm hoping

play26:38

someone comes up to me and says I

play26:39

brought in x86 with coreboot let's give

play26:42

it a shot okay

play26:43

and further yes anyone who wants to jump

play26:47

in and give me a hand the more we

play26:49

learned a better right maybe this will

play26:51

never work mate I'm actually pretty sure

play26:53

on wrist five it will work very well

play26:56

depending x86 not sure yet we'll see

play27:01

but yeah I'd anything anyone wants to do

play27:04

it love to have the help including code

play27:05

reviews of course so any more questions

play27:12

all right okay thanks thank you have

play27:16

another round of applause for one

play27:18

[Applause]

play27:22

[Music]

Rate This

5.0 / 5 (0 votes)

関連タグ
FirmwareLinuxBoot ProcessCorebootROM StageRAM StageUEFITechnologySecurityHardware
英語で要約が必要ですか?