The plain version
A breaker panel sits apart from the smart speaker so the speaker cannot flip a breaker. In Sawbones, the breaker panel is a small chip called the trust root. This note covers three things that merged: the first real code for that chip, an honest write-up of how it could be attacked, and the decision to keep it while adding a second, simpler part that can cut the power on its own.
The firmware core
#233 added sawbones-trust-root, the main loop written against a Board trait instead of real pins, and firmware/trust-root, the RP2350 image that implements the trait. The host tests run the same loop against a simulated board. CI builds the image for the chip and reports its size.
What the loop guarantees:
- Boot. Every output is driven off when the loop is made. The first tick reads the persisted fault record (a record that fails its check value is passed on as missing), takes a nonce from the hardware random number generator and restarts the interlock with both. If the generator gives nothing, the heartbeat never starts and nothing can arm.
- Outputs come only from the interlock's step. Each tick samples the pins, calls
steponce and drives the rails only from what it returned. - Cut first, record before on. Outputs that go off are driven off before anything else, and the record is written after. Before an output turns on, the new record is written and read back; if that fails, the output stays off.
- The charge pump is fed from one place. The relay's charge pump toggles once per tick, after a rail was driven on, never from a timer, PWM, interrupt or DMA.
ci/check_charge_pump.pyfails the build on a second call site. - A panel token comes only from the panel pin. A clear request from the link becomes a supervisor-sourced clear, which the interlock always refuses.
The threat model update
#239 added section 4a to the threat model: fault injection against the trust root. The reason is public. Raspberry Pi ran a hacking challenge on the RP2350 and published the winning attacks, which used voltage glitching, laser and electromagnetic injection to bypass secure boot or expose protected data. The section names the attacker (a person with the board on their own bench), says what the interlock does and does not promise, and marks each mitigation built or not built. It states that we do not rely on secure boot, OTP settings or the glitch detector as a safety layer, and that the design must be correct with them assumed broken.
The same PR made a rail turn on only when two independent reads agree: the outputs step returned and the state's mode returned by the same call. Host tests flip each in turn. That guards one corrupted value; it does not guard a corrupted program counter.
The decision
#242 recorded the call in the decision log:
- Keep the RP2350. It costs about a dollar, the firmware already builds for it in Rust in CI, it has signed boot, OTP, TrustZone and glitch detectors, and it shares a toolchain with the other modules. A different general-purpose part has the same class of published attacks. A lockstep safety part costs several times more and has weak Rust support.
- Add an external cut, required before any real power switching. A separate watchdog part with its own supply monitor asks the RP2350 questions. The relay stays on only while the answers come back right and on time. A frozen, glitched or misbehaving chip drops the rail by itself, and the scheme must work with whatever controller is chosen later.
The question-and-answer watchdog is established automotive prior art, not something we invented.
What is not done
Everything physical. The external cut is a requirement, not a design. The firmware does not yet arm the glitch detector or configure the brown-out detector, and the link protocol, panel display and durable record store are unwritten. Nobody has tried to glitch the board. The red-team card hw-037 records this as open.