Resolving Conflicts Between RTOS Timekeeping and Uninterruptable Trusted Computing

Antonio Joia Neto, Amarin Laohajirapan, Norrathep Rattanavipanon, Ivan De Oliveira Nunes · 2026

Read Resolving Conflicts Between RTOS Timekeeping and Uninterruptable Trusted Computing by Antonio Joia Neto, Amarin Laohajirapan, Norrathep Rattanavipanon, Ivan De Oliveira Nunes (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-24277.txt.

Introduction

Joia Neto and three colleagues resolve a conflict between operating system timekeeping and uninterruptable trusted computing on microcontrollers. Trusted Execution Environments isolate Secure and Non-Secure software sharing interrupt controllers, and real-time systems need SysTick interrupts for timekeeping. Trusted services require atomicity against the Non-Secure side, blocking SysTick handling. Their Secure-driven sync lets the Secure World measure time and credit the Non-Secure RTOS with missed ticks before re-enabling interrupts. The approach restores consistent time across worlds with no RTOS changes and little runtime overhead.

Catalog record

CREATORAntonio Joia Neto, Amarin Laohajirapan, Norrathep Rattanavipanon, Ivan De Oliveira Nunes
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE46961
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2604.24277

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Resolving Conflicts Between RTOS Timekeeping and Uninterruptable Trusted Computing Antonio Joia Neto, Amarin Laohajirapan, Norrathep Rattanavipanon, Ivan De Oliveira Nunes Abstract . Trusted Execution Environments (TEEs) on low-power microcontrollers (e.g., ARM TrustZone-M) enable isolation of Secure and Non-Secure software but still require both worlds to share resources, including interrupt controllers. In this model, real-time applications and real-time operating systems (RTOS-s) are executed in the Non-Secure sub-system, whereas the Secure sub-system is typically reserved for a small set of pre-defined security (e.g., cryptographic) operations referred to as trusted computing services. However, many RTOS-s rely on periodic interrupts (SysTicks) to advance their own notion of time (time-keeping), and the delivery of this interrupt is essential for preserving real-time behavior. On the other hand, the security of many trusted computing services requires atomicity vis-a-vis the Non-Secure sub-system (where the RTOS resides), precluding SysTick handling. This paper first characterizes this conflict and then introduces a Secure-driven time synchronization mechanism in which the Secure World measures elapsed time and compensates the Non-Secure RTOS by unobtrusively updating the RTOS time-keeping data structures with the appropriate number of missed ticks before re-enabling interrupts and resuming the execution of the Non-Secure system. This approach restores a consistent, monotonic notion of time across worlds and enables secure coexistence of trusted computing services and RTOS-s on microcontrollers. Importantly, the proposed approach requires no modifications to the underlying RTOS and yields no significant run-time overhead. 1. Introduction Embedded devices are ubiquitous, supporting applications that range from personal home automation (e.g., smart homes) to public, safety-critical environments (e.g., hospital machinery). As society grows more dependent on these devices, they have naturally become a high-value target for malware infestation attacks. To safeguard these systems, modern embedded platforms are now commonly equipped with Trusted Execution Environments (TEEs), which isolate security-critical operations from potentially application software. Among these, ARM TrustZone-M has emerged as the leading TEE for microcontroller (MCU)-class devices. TrustZone-M enforces isolation by dividing runtime execution into two hardware-enforced domains: the Secure World and the Non-Secure World . The Secure World can provide several trusted computing services, such as cryptographic functions, authenticated code updates/hot patching ( mackensen2025kintsugi ; niesler2021hera ) , remote attestation ( vrased ; smart ; trustlite ; hydra ; delegated ; casu ; parsel ; de2021toctou ) , control-flow integrity/attestation ( insectacide ; sherloc ; sok_cfa_cfi ; abadi2009control ; choi2024sum ; burow2019sok ; cflat ; iscflat ; traces ; oat ) , and more. To maintain run-time integrity, these services are commonly designed to run atomically. This is enforced by disabling Non-Secure World interrupts during their execution ( vrased ; Sancus17 ; traces ; carpent2018temporal ) . For example, a Secure World hot-patching service must not be interrupted by the Non-Secure World; otherwise, malware residing in the Non-Secure World could abuse an intermediate state to alter the patch content before completion of the patching process. Similarly, in remote attestation, malware could interrupt the measurement process and relocate itself into a memory region that has already been measured to evade detection ( castelluccia2009difficulty ; cui2013firmware ; de2021toctou ) . In the context of real-time embedded systems, the Non-Secure World likely hosts a real-time operating system (RTOS), including its kernel and application tasks. As temporal predictability is essential in such systems, the RTOS kernel heavily relies on periodic interrupts , notably the SysTick interrupt, to provide core functionality such as task scheduling, timeout handling, and deadline enforcement. The timely availability of these interrupts is therefore crucial: even small disruptions in tick delivery can accumulate over time, leading to clock drift/incorrect time-keeping, ultimately undermining real-time guarantees. In this work, we show that this requirement from RTOS has a severe direct conflict with the security requirements of TEE’s trusted computing services: when the Secure World executes a service atomically, it disables Non-Secure interrupts, thereby preventing the SysTick interrupt from firing in the Non-Secure World. As a result, the RTOS may miss (potentially many) SysTick events, resulting in a gap in its notion of time, gradually diverging its internal clock from the real time. Prior work on TrustZone-M–based trusted computing services (see Section 8 ) largely overlooks this issue. While some approaches aim to keep trusted execution very fast and frequent (e.g., atomic security checks for control-flow integrity) to reduce schedulability interference, they fail to account for the impact on system timekeeping caused by blocking the SysTick interrupt. As we show in this work, even such fast atomic operations can still cause SysTick events to be missed; when this occurs frequently, the resulting tick losses are amplified, accumulating over time. Moreover, this phenomenon is also overlooked in traditional real-time analysis, which typically assumes that non-preemptive sections—including those that block interrupts—operate within a single scheduling domain (i.e., the same privilege level) under one operating system or scheduler ( sha2004real ) . TEEs shift away from this assumption in multiple ways. Being on a different privilege level, their execution time is dependent on dynamic security workloads; they can globally disable Non-Secure interrupts; and their timing is opaque to the Non-Secure RTOS. As a result, their interference cannot be properly modeled or bounded using conventional scheduling frameworks unless explicitly accounted for. After introducing and characterizing this problem, we propose a mechanism to preserve RTOS time-keeping correctness across the execution of atomic trusted services. Specifically, our goal is to ensure that, when control returns to the Non-Secure World, the RTOS observes the same kernel-visible state it would have observed had all elapsed tick periods been accounted for correctly. This state includes correct logical tick advancement, release of overdue delayed tasks, expiration of crossed timeouts, preservation of software timer state, and correct reschedule state. Contribution. This paper makes the following contributions: • Characterization of Cross-World Timing Drift. We show that atomic Secure-world execution in TrustZone-M can suppress multiple SysTick expirations, causing the Non-Secure RTOS to undercount time. We formalize this behavior, derive bounds on drift accumulation, and empirically validate the model through experiments on two major embedded RTOS-s (FreeRTOS ( freertos ) and Zephyr ( zephyr ) ) running atop a real ARM Cortex-M33 hardware platform. • Cross-World Time Reconciliation. We propose a lightweight mechanism in which the Secure World maintains a trusted monotonic time reference to track suppressed ticks and transparently reconciles them with the RTOS once the atomic execution of a trusted service completes. As a result, our approach preserves the atomicity required by trusted services while maintaining proper RTOS time progression, providing required guarantees without requiring hardware modifications or changes to the underlying RTOS or application logic. This makes our mechanism readily deployable on existing TrustZone-M devices in real-time environments and compatible with existing applications. We release an open-source prototype realizing the proposed mechanism ( anon_repo ) . • Control System Case Study. We contextualize the practical impact of Cross-World time drift on a closed-loop control system of a DC motor (speed and position control). These experiments show that uncompensated clock drifts due to SysTick suppression can introduce missed control releases, increased tracking error, and control-signal disturbances. The proposed compensation mechanism successfully remediates the issue, preserving timing and control behavior. 2. Background ARM TrustZone for Cortex-M . TrustZone-M implements a hardware-enforced split between a Secure and a Non-Secure world on ARM Cortex-M MCUs. Each world maintains its own

Read the complete text