Access Official Technical PDF

Share Summary:LinkedInEmail

Hardware snapshotting can address a persistent challenge in embedded systems security testing: keeping peripheral state consistent with firmware state during analysis. Fuzzing and dynamic symbolic execution can explore inputs and execution paths, but their results depend on realistic interactions between firmware and hardware. When a test environment cannot inspect or restore peripheral state, it risks slow reboots, incomplete failure reproduction, or misleading analysis.

HardSnap presents a virtual-machine-based approach that snapshots hardware peripherals alongside software. It is intended for hardware/software co-designed systems where engineers have access to the design, such as its Verilog source. By extending visibility and control to the hardware, the approach supports repeatable testing without relying solely on modeled peripherals or interaction with a physical device.

Why peripheral state matters in firmware testing

Embedded firmware routinely communicates with peripherals through memory-mapped or port-mapped I/O. A peripheral may provide an interface to sensors or actuators, enable device-to-device communication, accelerate computation, or manage resources such as interrupts and DMA. Its behavior can affect firmware data flow and control flow: it may supply input values, change memory, or raise an interrupt that sends execution into an interrupt handler.

This coupling means a firmware test cannot always treat the hardware as a passive input source. A security issue may arise from the interaction itself, and analysis needs to account for the state held inside the peripheral as well as the state held by the program.

The limits of existing testing approaches

When peripheral design files are unavailable, testing tools may replace hardware with behavioral models. These can be written manually or generated automatically, but approximating complex peripheral behavior is difficult and can produce unrealistic interactions. That can affect whether a test identifies a genuine issue or overlooks one.

Hardware-in-the-loop approaches instead forward I/O to a real device. This avoids modeling some behavior, but the analysis tool has limited access to the device’s internal state. If multiple symbolic execution paths share one physical peripheral, their interactions can interfere with each other. The resulting hardware state may no longer correspond to the software state being analyzed.

Simulation offers a different trade-off. When hardware description language (HDL) models are available, a simulator can provide detailed visibility and control. However, simulation may run substantially slower than hardware. FPGA implementations can provide higher execution performance, but typically offer less access to internal design state. These trade-offs also make complete snapshots difficult.

How hardware snapshotting supports consistent analysis

A conventional virtual-machine snapshot captures software execution state so a test can resume from a saved point instead of restarting from the beginning. HardSnap extends that idea to peripherals. A combined snapshot records firmware state and hardware state, allowing the analysis to restore both together.

This matters when a symbolic execution engine forks at a branch condition. Each resulting software path needs a corresponding peripheral state. Without that association, one path could change a peripheral in a way that affects another path, creating behavior that does not represent either execution accurately. Restoring the matching hardware snapshot before continuing helps preserve the relationship between firmware and peripheral state.

Snapshots can also help reproduce a fault at the point it occurred, supporting closer examination of the relevant hardware and software conditions. For fuzzing, restoring a saved state can avoid repeatedly rebooting and replaying initialization. For symbolic execution, it can reduce the work required to explore alternative paths from a common point.

Two hardware targets, different trade-offs

HardSnap uses HDL instrumentation to support snapshots across simulator and FPGA targets. The choice depends on the design and the priorities of the analysis.

Simulator-based testing

For simulation, Verilog models are converted into a C++-based simulator using Verilator. The simulator is extended with a remote interface so an external virtual machine can communicate with the peripherals through a memory-bus abstraction. Because the simulated design’s state is represented in software, it can be observed and controlled. The simulator process can also be checkpointed and restored. This option is useful when detailed traces and introspection are important, although simulation speed can be a constraint for complex designs.

FPGA-based testing

For FPGA testing, HardSnap inserts a scan chain into the HDL. The chain provides a path for reading and restoring the design’s hardware registers, enabling the peripheral state to be captured even when the FPGA does not otherwise provide broad internal visibility. This approach is intended to retain the performance benefits of FPGA execution while enabling hardware snapshots. Its introspection mechanism differs from the simulator’s, so the targets suit different analysis needs.

HardSnap can also transfer hardware state between targets during analysis. For example, a test can use an FPGA for execution and move to a simulator when detailed tracing is needed. This multi-target approach lets teams balance execution performance against visibility rather than relying on a single environment.

Practical considerations for engineering teams

Hardware snapshotting is most applicable when the design information needed to instrument peripherals is available. The method is therefore relevant to manufacturers, developers of open hardware, and teams working on systems where hardware and firmware are developed together. It can support testing a complete design or a selected subsystem, including analysis of firmware drivers before the entire system is available.

When considering a similar workflow, engineering teams should account for:

  • Peripheral coverage: Identify which hardware blocks influence the firmware paths and security properties being tested.
  • Analysis goals: Use simulation where detailed visibility is needed and FPGA execution where design complexity makes simulation performance a concern.
  • State consistency: Ensure each software execution state is paired with its corresponding hardware state, especially when exploring paths concurrently.
  • Symbolic inputs at hardware boundaries: Decide how symbolic values passed to concrete peripherals will be converted into test values. HardSnap allows this policy to be configured to favor broader value coverage or performance.

The framework’s prototype was evaluated using open-source peripherals and synthetic firmware, including a programmable interrupt controller, timer, and cryptographic hardware blocks. This demonstrates the intended co-testing workflow; it does not remove the need to validate the approach against the specific peripherals and firmware in a production design.

Conclusion

Embedded security analysis is more dependable when a test environment preserves the connection between firmware execution and peripheral behavior. Hardware snapshotting extends VM snapshot techniques to include peripheral state, helping avoid repeated reboots and reducing inconsistencies between execution paths. For engineering teams with access to hardware designs, combining simulation and FPGA targets can provide a practical way to balance introspection and execution speed during firmware and hardware security testing.

Access Official Technical PDF

About The Author