spi-lockdown

Linux kernel module to protect PC firmware from modifications via SPI flash writes

View on GitHub

x86 SPI Lockdown Kernel Module

This module is meant to be used to prevent firmware modification as part of a SecureBoot authenticated execution environment. Where it is hardened such that there is no /dev/mem access or privileged IO available. (because if you have those things you can just do this from userspace)

These awesome slides give a full description of how this mechanism works.

Tested on amd64 debian, 3.16 kernel, and [ICH10R LPC Interface

With this miraculous technology you can:

ALL FROM THE COMFORT OF RING 3!

But wait, there’s more!

Tested on amd64 debian, 3.16 kernel, and ICH10R LPC Interface Controller

Installation and Usage

apt-get install linux-headers-$(uname -r)
git clone git@github.com:burritoaddict/spi-lockdown.git
cd spi-lockdown
make
insmod spi_lockdown.ko
sysctl -w dev.spi_lockdown.pr0=2415886336   # write protect entire
                                              region (0x8fff8000)
sysctl -w dev.spi_lockdown.flockdn=1        # prevent SPI protection
                                              modifications

Note: flockdn cannot be disabled after running sysctl without a ‘reset’. On some systems that means waking from sleep

sysctl interfaces

TODO

References