Repository navigation
Bootloaders opensbi
RISC-V Supervisor Binary Interface reference implementation.
| Type | Firmware bootloader (type1) |
| Upstream | https://github.com/riscv-software-src/opensbi |
| CVEs attributed | 0 |
| Vulnerability-fixing commits | 0 naming a CVE, 28 keyword-matched |
| CVEs with a linked fix | 0 |
Runs in M-mode, sets up the machine, provides the SBI ABI, then enters S-mode at the next stage.
Type 1: it is the privileged firmware layer presenting a stable interface to whatever boots next -- the RISC-V analogue of UEFI's role.
See Boot-Stages for the eight-stage model these phases map onto.
- _start -- The first hart enters the firmware; others are held in a wait loop. Sets up the stack and the per-hart scratch space.
- cold boot path -- The boot hart relocates the firmware if needed, initialises the console and platform, and parses the device tree.
- warm boot path -- Each remaining hart initialises its own trap handling, timers and interrupt controller.
- sbi_init -- Registers ecall extensions (timer, IPI, HSM, reset) and defines the domains that partition memory and devices.
- next stage -- Configures PMP for the next stage's domain and drops from M-mode to S-mode at the payload's entry point.
OpenSBI passes forward a device tree, which it may edit first -- reserving its own memory so the next stage does not use it, and adding nodes for what it manages. After the transition the interface is not a table but the ecall instruction: the S-mode payload traps into M-mode for timers, IPIs, hart state management and system reset. The three build shapes differ only in where the next stage comes from: FW_JUMP jumps to a fixed address, FW_PAYLOAD embeds the next stage in the firmware image, and FW_DYNAMIC takes its parameters from a struct the previous loader filled in.
The handoff is an mret into S-mode with a0 set to the hart ID and a1 to the physical address of the device tree -- the same convention the Linux RISC-V kernel expects. PMP entries are programmed first so the supervisor cannot reach firmware memory. OpenSBI stays resident in M-mode for the life of the system.
Detected in its build configuration and source:
- rollback protection
- stack protector
See Security-Mechanisms for how these are detected and what a detection does and does not prove.
git -C oss-bootloaders submodule update --init type1/opensbi
./scripts/analysis/run-tool.sh codeql opensbiSee Tools for what each tool applies to.