Abstract

Embedded systems are inherently event-driven, relying extensively on interrupts to facilitate real-time interactions with hardware. Interrupt-oriented programming is fundamental to the design and functionality of embedded systems, enabling them to dynamically respond to real-time events. Despite careful development efforts, frequent and event-triggered nature of interrupt service routines (ISRs) can still precipitate race conditions. This leads to concurrency vulnerabilities between application tasks and interrupt handlers. Existing methods to patch race conditions typically rely on source code, which may not be available in many real-world scenarios. Additionally, traditional patching methods often fail to ensure patches do not interfere with the baseline functionality of the system. Furthermore, compiler optimizations may reorder operations and potentially induce race conditions even when the source code appears safe. In this paper, we discuss a race condition identified during the testing of an Intrusion Detection and Prevention System (IDPS) developed for research on a Controller Area Network (CAN) used in commercial vehicle systems. We detail the discovery , analysis, and resolution of this race condition through the open-source CodeHawk Binary Patcher, a novel, assured binary micropatching platform. Micropatching is specifically chosen for its ability to change the fewest possible bytes in the system's firmware, thereby minimizing potential side effects while providing validations that the patch preserves the original baseline functionality of the system. This approach is particularly crucial in scenarios where source code is unavailable. Our method not only ensures the effectiveness of the patch but also provides a rigorous assurance case demonstrating that the patches do not interfere with the system's baseline functionality, thus preserving the integrity and validation efforts of the original software. This research not only offers a practical solution to a specific concurrency vulnerability but also significantly enhances the broader framework for addressing race conditions in embedded real-time systems.

Download Publication