ECE 441 · Week 4

Modern Computer: Secure Infrastructure

A rebuild has an identity: the hash of its image, and one console line only that build prints.

Week 4 of 10 · Solitude

ECE 441 · Week 4 · In class

A rebuild has an identity: the hash of its image, and one console line only that build prints.

ECE 441 · Week 4 · In class

A rebuild has an identity: the hash of its image, and one console line only that build prints. (continued)

ECE 441 · Week 4 · In class

You and your partner each rebuild from a clean tree on a different bench PC and compare the two image hashes.

ECE 441 · Week 4 · Lecture

Why the same bytes matter

ECE 441 · Week 4 · Lecture

An image's identity

sha256sum <image>
git -C <tree> rev-parse HEAD
git -C <tree> status --porcelain   # empty means clean

ECE 441 · Week 4 · Lecture

What leaks into a build

LeakHow it showsUsual fix
Build timeA date string in the imageSOURCE_DATE_EPOCH
Build pathYour home directory in the imageSame path, or a prefix map
ToolchainDifferent code in many placesThe same compiler version
Local edits-dirty, or real changesA clean tree

ECE 441 · Week 4 · Lecture

Pinning the date

# the time of the last commit, not the time of the build
export SOURCE_DATE_EPOCH=$(git -C TREE log -1 --format=%ct)
date -u -d @"$SOURCE_DATE_EPOCH"

ECE 441 · Week 4 · Lecture

Finding the first difference

sha256sum mine.bin theirs.bin
cmp mine.bin theirs.bin          # first differing byte
cmp -l mine.bin theirs.bin | wc -l   # how many differ
strings -t x mine.bin | grep -i '<text>'

ECE 441 · Week 4 · Lab

Lab

  1. From a clean tree, rebuild the open bootloader on the bench PC and record the hash of the image; your partner rebuilds it independently on another bench PC.
  2. Compare the two hashes. If they differ, find the first differing bytes and name the cause, such as a timestamp, a path, or a toolchain version. Boot the board from your build and record the console line that only that build prints. Second pass: reboot from that same build and confirm the same identity line.

ECE 441 · Week 4 · Lab

Lab (continued)

  1. Assemble the lab hand-in: The two image hashes, identical or with the first difference and its cause, the console line that only your build prints, and the commands a classmate uses to rebuild and boot it.

ECE 441 · Week 4 · Lab

Hand in

The two image hashes, identical or with the first difference and its cause, the console line that only your build prints, and the commands a classmate uses to rebuild and boot it.

ECE 441 · Week 4 · Homework

Homework

ECE 441 · Week 4 · Homework

Turn in

The command and the directory.

ECE 441 · Week 4 · Read

Read

On the lab site: Module 4, Loading the bootloader into SRAM, and Module 6, Software in DRAM, describe the stages. This week grades the rebuild. The basic modules stop at Module 12.

ECE 441 · Week 4 · Next

Week 5

A method names instruments, steps, and what to record.

Arrow keys or space to move, F for full screen, N for speaker notes, Home and End for the first and last slide. Print gives one slide per page.