Why it runs on QNX
A late piston stroke is a bruised chest or a breath on the downstroke. A crashed classifier must not take the piston with it. Those are operating system problems, and QNX was built for them.
Small processes, clear jobs
Each part is its own QNX process with its own priority, user and security type. They talk through message passing and shared memory that never blocks the control loop.
elvrekd
The safety authority. Wakes every millisecond, runs the state machine and the independent monitor, and is the only writer to the actuators.
elv-plant
Stands in for the hardware today: actuator, chest, load cell, capnograph, ECG and charger. Owns the hardware watchdog.
elv-super
Restarts the advisor when it dies or goes quiet. Never restarts the safety process.
elv-advisor
The rhythm classifier. Unprivileged, abilities locked, reads only a copy of the ECG, writes only advice.
elv-telemetry
Streams status to the crew console over the network. Has no way to write into the safety process.
elv-ctl
Start, stop, shock, mode and transport commands from the crew, through a device only root may open.
The AI may suggest. QNX decides who may touch.
- The advisor drops to its own user and locks the abilities it could use to climb back: priority, spawn, fork, setuid, physical memory and I/O.
- The piston and shock devices are read only. The operator device is root only. The hardware memory is root only.
- An enforced QNX security policy runs every process under its own type. Advice goes through a small gate process, and the advisor may connect to the gate and nothing else. Kept as root under its type, the advisor is still refused the piston and the shock line by the kernel itself (5 of 7 attacks refused as root, 7 of 7 as designed, 0 of 7 without the type).
- Its worst case is to talk the controller out of one pre-charge. The next two minute boundary is always checked.
elv-advisor -atries every forbidden path and prints the refusals. It is a test case on the target.
Piston, charger, shock line
Written only by elvrekd, through shared memory owned by root.
elv-advisor
Unprivileged user, locked abilities, read only ECG.
Eight states, one owner
The highlighted state moves as the recorded run plays on the evidence and replay pages. Here it walks through a typical rescue.
Hands on
Compress is the only hands-on state. Chest compression fraction counts the time spent here against the time CPR is needed.
Hands off, on purpose
The shock window and the 30:2 breath gap are the only planned pauses, and both have hard time limits.
Hands off, for safety
Return of circulation, fault retract and safe hold all park the piston at full recoil.
Native, not ported
| Timer pulses on a private channel | The 1 ms control tick, received at a fixed priority with MsgReceivePulse. |
|---|---|
| Resource managers | /dev/elvrek/status, advice, operator, piston and shock, served with iofunc permission checks. |
| Message passing priority inheritance | A flooding advisor at priority 10 is served at priority 10 and cannot delay the loop at 60. |
| procmgr_ability | The safety process and the advisor each deny and lock what they no longer need. |
| Security policy types | One type per process; the advice path gets its own channel type with allow_attach. |
| System Launch and Monitor | Starts the stack in order, pins the safety process to its own CPU, and marks it repair none. |
| slog2 | Faults and forced retracts are logged without file I/O in the control loop. |
| mkqnximage | Builds the bootable QEMU image with the stack and the fault suite on it. |
Build it yourself
Target: QNX SDP 8.0, x86_64 in QEMU or aarch64 on a Raspberry Pi 5. Toolchain: qcc. The same safety core also builds on any Linux machine for the host tests.
Open the repository