The Mars Pathfinder reset of 1997 was caused by priority inversion on a mutex without inheritance — a one-line class of bug. Nearly thirty years later, QNX 8.0 teams still write the same six defect classes because they are legal C, compile clean, and pass ordinary testing. qnxrt-guard encodes that missing knowledge.

What it does

qnxrt-guard scans C/C++ source trees and QNX buildfiles for 18 realtime-correctness rules derived from QNX kernel semantics: priority inversion, heap allocation and stdio in realtime loops, relative-sleep timing drift, CLOCK_REALTIME misuse, missing overrun detection, forbidden calls in ISRs, blocking MsgSend in RT threads, unchecked channel/pulse operations, and buildfile hygiene. Every finding carries the kernel-level rationale, the canonical fix, and a link to QNX documentation — the report doubles as training material. Output: text, JSON, SARIF for GitHub code scanning; ships as a GitHub Action with severity gates.

How we built it

Python 3.9+, zero dependencies, pip-installable. Comment/string-stripping C lexer, brace-matched function extraction, RT-scope heuristics, rule plugin architecture. Validated three ways: vulnerable/fixed example pair (1 kHz servo control app, ten planted defects all caught, zero false positives in fixed version), real-world scans against QNX qnx-ports repos (27 genuine findings incl. CLOCK_REALTIME misuse in lighttpd), and a 45-minute codelab teaching every defect class.

What makes it QNX-specific

Every rule encodes Neutrino microkernel semantics: priority inheritance protocols, InterruptAttach vs InterruptAttachEvent, synchronous MsgSend/MsgReceive/MsgReply IPC, pulse merging, sigevent delivery types, APS configuration in buildfiles, ThreadCtl I/O privilege. The host-tool design is deliberate: analyzes code for QNX 8.0 targets from any developer machine or CI runner — exactly how embedded teams work.

Challenges

Distinguishing realtime-scoped code without false positives required layered heuristics. Severity calibration came from triaging real qnx-ports findings.

Accomplishments

Ten planted defects all detected; fixed example scans clean; 27 real findings in production QNX ports; SARIF/GitHub Action CI integration; a codelab that turns the tool into a curriculum.

What we learned

QNX IPC and interrupt architecture in depth; how RT defects hide inside perfectly legal C.

What is next

QEMU end-to-end latency measurement integration (analyze, build, boot, measure), deeper dataflow analysis, rule packs for resource manager patterns, upstream feedback to qnx-ports maintainers.

Built With

  • embedded
  • python
  • qnx-8.0
  • realtime-systems
  • sarif
  • static-analysis
Share this project:

Updates

Submission history