Features Documentation Examples Repository Blog Contact

Benefits of Userspace Drivers

This is a case study of a firmware bug in sensor driver connected to a communication bus problem. A manufacturer of RV appliances had an ecosystem with temperature sensors which were connected to STM32-based controller. These sensors were sometimes sending unexpected malformed data which the driver wasn’t handling properly. When this rare-yet-recurrent malformed data arrived the driver wrote these meaningless data into unauthorized memory locations in the controller’s memory.

Eventually this memory corruption hit a critical location which stored internal state of slide open/close command.

Fortunately in this case there were other safety measures implemented to prevent slide from opening unintentionally so the safety of the system wasn’t compromised.

While this is an industry-common example of poor handling of incoming data, cases like these are not uncommon. As the complexity of software increases so do increase the state space of cases which are hard to anticipate. Remember, that this case actually started as a hardware issue with sensor sending unexpected data.

In typical embedded firmware, drivers are given unlimited access to controller’s memory. They are considered being part of the kernel and privileged region of firmware and as such are treated as something that should be protected rather than something that could cause damage. Manual MPU configuration complexity and monolithic kernels make it very hard to isolate drivers effectively. In such environment a driver bug can create memory corruption vulnerabilities affecting the whole system.

In CMRX, all drivers are explicitly and automatically given access only to areas of memory they need for their proper operation through zero-configuration memory isolation. In this case the driver for sensor would be given access just to the peripheral, sensor was using to talk to the controller. If driver contained a bug that would do unauthorized memory access, this would get caught by the hardware itself automatically.

Automatic memory protection provides two critical advantages:

Rather than relying on other safety measures, you rely on cybersecurity measures. That means there are two lines of defense. If you were relying just on redundant safety measure to prevent safety-relevant malfunction caused by a software bug, then firmware containing a driver bug is effectively working in a state where some safety measures are degraded 100% of time. Out of two safety measures implemented one is defunct. This renders your safety analysis invalid as the double redundancy you expect to prevent some risk basically doesn’t exist.

Memory isolation creates layered defense: your existing safety measures plus automatic containment of driver failures. There are actually three separate measures that can be considered safety-relevant. Two from the non-isolated case and memory isolation itself. Any bug in the driver is confined unless memory isolation fails. And that’s one big IF.

Second advantage provided by memory isolation is that the bug itself will be exposed much sooner. Sporadic bugs which depend on specific system state are extremely hard to find and even if they are found their analysis might be complicated as it is hard to identify the exact state which causes them. With memory isolation the access to off-limits memory area will trigger Memory Management Fault of your microcontroller. Even if such bug is extremely rare, hitting memory management faults time to time should give you a hint that there’s something wrong with the code. Great advantage of memory management faults is that they catch the software red-handed and you can inspect the state of the firmware just as the wrong memory access is happening. This provides you with investigation scene with no additional effort to confine the bug.

This latter effect means that whole classes of bugs that are usually hard to catch are now more likely to be discovered during the development phase. Yes, memory corruption can still happen if the code contains bugs but the area which they can affect without raising an alarm is much smaller and is confined to one logical function of the firmware. So with zero-configuration memory isolation of drivers in place a bug in temperature sensor driver may still cause unexpected behavior of the temperature sensor input but can’t cause mysterious glitches of e.g. motor control or radio.

Compliance and Regulatory Context

As embedded system cybersecurity laws emerge potentially requiring developers to implement robust memory protection, this type of memory corruption vulnerability represents exactly the kind of security gap that regulatory frameworks are designed to prevent. Manual MPU configuration complexity is no longer viable for meeting compliance timelines, and the automated nature of CMRX’s memory isolation addresses these emerging requirements without performance impact - hardware-based MPU protection adds only small, well-defined and predictable runtime overhead compared to systems completely without memory isolation. The key advantage is drastically reduced development effort and elimination of human configuration errors, giving customers the same level of confidence in meeting compliance requirements without the risk of excessive time and cost overruns.

Take Action on Memory Isolation

If your embedded systems face similar memory corruption vulnerabilities, CMRX provides zero-configuration memory isolation that addresses these compliance and security challenges:

  • Automated Protection: Hardware-based driver isolation with minimal runtime overhead
  • Compliance-Ready: Audit-ready fault reporting and automated vulnerability containment
  • Rapid Deployment: Implement memory protection in days, not months

Next Steps:

Ready to evaluate CMRX for your compliance requirements? Contact us for integration and commercial support discussions.

64kB of protected memory ought to be enough for everyone.