arXiv:2610.27325cs.SEOct 2026

Manuscript Offprint

arXiv:2610.27325

XRust: Detecting Logical Races in Rust Linux Drivers

Qingxiao Xu, Ze Sheng, Zhicheng Chen, Arjun Manikandan, Jeff Huang

QINGXIAO XU, Texas A&M University, USA

SHENG ZE, Texas A&M University, USA

ZHICHENG CHEN, Texas A&M University, USA

ARJUN MANIKANDAN, Texas A&M University, USA

JEFF HUANG, Texas A&M University, USA

Rust is increasingly used in Linux to improve memory safety, but its guarantees do not prevent logical races: individually synchronized operations can still interleave in ways that violate higher-level invariants. Detecting such bugs typically requires manually written specifications and carefully controlled execution environments.

We present XRust, a technique for detecting logical races in Linux Rust drivers without manually specified invariants. Using Logical Happens-Before (LHB) analysis, XRust identifies shared-state accesses relevant to logical ordering, automatically constructs operation-pair harnesses, and uses serial differential oracles to detect concurrent executions inconsistent with either serial order. XRust also uses lightweight userspace abstractions to execute driver code under reproducible schedules. Applied to Linux 7.3-rc2, XRust identifies 17 shared objects across 102 Rust files from ten drivers, constructs 1,654 executable harnesses, and discovers two previously unknown logical races. The rnull block-driver race has been confirmed by Linux maintainers, with a fix accepted into the Linux block subsystem tree.

CCS Concepts: • Software and its engineering → Dynamic analysis; Software testing and debugging.

Additional Key Words and Phrases: Rust, Linux kernel, logical races, dynamic race detection, controlled concurrency testing

1 Introduction

Rust offers a path toward eliminating memory-safety vulnerabilities and data races through its ownership and type systems [31]. These guarantees are particularly compelling for operating-system kernels, where a single defect can have system-wide consequences [13]. Linux, historically implemented primarily in C, has long faced memory-safety and concurrency bugs due to manual memory management, unrestricted pointer manipulation, and complex synchronization protocols [9].

Rust-for-Linux (RFL), launched in 2020, is an effort to bring Rust’s memory- and thread-safety guarantees into the Linux kernel and enable kernel components, particularly device drivers, to be written in Rust [4, 30]. The first functional Rust driver was merged into Linux 6.8 in early 2024. Since then, Rust adoption in Linux has accelerated, growing from 95 SLOC in 2024 to 19,726 SLOC by September 2026 [13].

The increasing complexity of this code is exemplified by Android Binder: Google’s Rust Binder driver entered mainline Linux in version 6.18, with ongoing work toward replacing the legacy C implementation [16, 25, 26]. This rapid evolution—from basic language support to complex, highly concurrent drivers—makes understanding the concurrency correctness of Rust kernel code increasingly important.

However, Rust’s memory- and thread-safety guarantees do not imply that Linux drivers written in Rust are free of concurrency bugs. In 2025, a severe vulnerability (CVE-2025-68260) was reported in the Rust Binder driver [14], as illustrated in Figure 1. The vulnerability arose from an invalid assumption about list ownership and lock protection. Concurrent operations are allowed and corrupt the notification list. This example highlights an important limitation of Rust’s safety guarantees: they do not ensure the logical correctness of concurrent operations. A driver may be free

Authors' Contact Information: Qingxiao Xu, Texas A&M University, USA; Sheng Ze, Texas A&M University, USA; Zhicheng Chen, Texas A&M University, USA; Arjun Manikandan, Texas A&M University, USA; Jeff Huang, Texas A&M University, USA.

Xu et al.

Figure

Fig. 1. CVE-2025-68260 in the Linux Rust Binder driver. A accesses links via local. B accesses links via self. The owner lock does not guard the local list.

of conventional data races yet still behave incorrectly when individually valid operations interleave in a way that violates a higher-level protocol or state invariant.

We call such a failure a logical race: an execution in which the ordering or interleaving of concurrent operations invalidates a logical assumption on which one or more operations depend. As increasingly complex Linux components are implemented in Rust, detecting such bugs becomes increasingly important because they fall outside the class of concurrency errors that Rust’s type system is designed to prevent.

In this case, Binder maintains a list of death notifications associated with each node. During node destruction, Node::release moves these notifications to a temporary local list and releases the node lock before processing them. A concurrent operation may nevertheless attempt to remove a notification under the assumption that it is either linked to its owner's list or not linked to any list. Moving the notification to the temporary list violates this assumption: the notification remains linked, but is no longer protected by the lock expected by the concurrent operation. The two operations may therefore manipulate the same notification under incompatible assumptions about its state, eventually corrupting the underlying list. This example illustrates a broader challenge: logical races arise from violations of program-specific invariants that are often implicit in the code rather than enforced by Rust's type system.

Detecting logical races of this kind is non-trivial for several reasons:

• Challenge 1 Concurrency testing requires an oracle that distinguishes an incorrect interleaving from a valid concurrent execution. One approach is to manually specify the intended behavior. E.g., CONVEROS [29] verifies 12 concurrency modules in the Rust-based OS Asterinas [23] using PlusCal specifications derived from its implementation. Such specifications can express rich safety properties, but constructing and maintaining them requires substantial effort and expertise. Kernel concurrency fuzzers can expose failures through controlled schedule exploration. E.g., SECT [33] injects scheduling points through LLVM instrumentation and uses a sched_ext-based eBPF scheduler to explore kernel thread interleavings. Such testing, however, still requires an observable failure condition or other oracle to determine whether a particular execution is incorrect. For logical races, the challenge is therefore not only to expose unusual interleavings, but also to determine automatically whether their behavior is semantically invalid.

  • Challenge 2 The number of possible executions grows rapidly with the number of threads and scheduling points. Controlled concurrency testing addresses this problem by repeatedly executing a harness under different controlled schedules. Loom [32] systematically explores valid execution permutations while applying state-reduction techniques, whereas Shuttle [1] emphasizes randomized schedule exploration together with deterministic replay of failures. Nevertheless, their effectiveness depends critically on which operations a harness exercises and where scheduling choices are introduced [3]. Exploring every possible scheduling point is prohibitively expensive for realistic driver code; effective testing must instead identify the interleavings most likely to expose violations of logical ordering constraints.

  • Challenge 3 Linux drivers depend heavily on kernel interfaces and execution contexts that are difficult to reproduce in a small, deterministic userspace test. A Rust driver does not execute in isolation: it invokes kernel interfaces implemented in both Rust and C and interacts with kernel objects, callbacks, synchronization primitives, and lifecycle management. Testing a small piece of driver logic inside a complete Linux kernel requires executing a large system in which unrelated kernel activity makes fine-grained schedule control difficult. RustMC [22] operates over LLVM IR to model-check concurrent Rust programs, including programs with C/C++ dependencies. However, controlled concurrency testing of Linux Rust drivers still requires a lightweight execution environment that faithfully reproduces the kernel dependencies and synchronization behavior relevant to the driver code under test.

To address these challenges, we propose XRust, a technique for detecting logical races in Linux Rust drivers. At the core of XRust is a new relation, Logical Happens-Before (LHB), which captures semantic ordering requirements between operations on shared state. Conventional happens-before characterizes ordering induced by program order and synchronization and is commonly used to reason about conflicting memory accesses. LHB preserves thread-local program order while omitting the mutex release-acquire ordering. Two operations may individually use synchronization correctly and contain no conventional data race, yet an interleaving of their constituent steps may still produce behavior that cannot be explained by any valid serial execution. XRust uses this distinction to identify and test precisely such interleavings.

First, XRust automatically constructs an executable oracle for logical races. For a pair of operations on a shared state, XRust executes the operations sequentially in both possible orders from equivalent initial states and records their observable outcomes. These serial executions define the reference behaviors for the operation pair. XRust then executes the same operations concurrently under controlled schedules. If a concurrent execution produces an observable state or outcome that is inconsistent with both serial orders, XRust reports a potential logical race. This serial-equivalence oracle avoids requiring developers to manually encode a separate invariant for every operation pair while still capturing violations of their expected atomic behavior.

Second, XRust uses LHB to focus exploration on promising interleavings. Exhaustively inserting scheduling decisions at every memory access would create an impractically large search space. XRust instead performs runtime analysis of shared-state accesses and synchronization events to identify points at which the relative ordering of the two operations may affect their logical behavior. These observations are used to prioritize scheduling points around accesses to shared state and around synchronization boundaries that may separate logically related steps. XRust then guides controlled concurrency testing toward these candidate interleavings rather than exploring the entire schedule space uniformly.

Xu et al.

Third, XRust uses a lightweight userspace abstraction to execute Linux Rust driver code under controlled schedules. Rather than running the driver inside a full Linux kernel, XRust emulates only the kernel interfaces exercised by a target harness, replacing them with lightweight userspace implementations that preserve the state, synchronization, and callback behavior relevant to concurrency testing. These implementations are constructed with assistance from Claude Code (claude-opus-5) and checked through compilation and manual compatibility review. The original Rust driver logic remains unchanged. Within this environment, XRust uses Shuttle to control thread scheduling and record executions that trigger oracle violations, enabling deterministic replay of reported logical races.

XRust performs its shared-state and synchronization analysis dynamically on compiled harnesses. It extends ThreadSanitizer [28] to observe memory accesses and synchronization relationships at runtime, avoiding the need for a whole-program static model or source-level rewriting of synchronization primitives. Combined with the lightweight userspace abstractions described above, this design allows XRust to analyze executions of real Rust driver code while retaining precise control over thread scheduling.

In summary, this paper makes the following contributions:

(1) We introduce Logical Happens-Before (LHB), a formulation for reasoning about semantic ordering requirements between concurrent operations. Such exposed synchronized access conflicts may be individually data-race-free yet collectively violate higher-level state invariants.

(2) We present XRust, an automated technique for detecting logical races in Linux Rust drivers. XRust constructs operation-pair harnesses and serial-equivalence oracles, guides schedule exploration toward interleavings likely to violate logical ordering constraints, and supports deterministic replay without requiring manually specified invariants.

(3) We develop a lightweight userspace approach for executing Linux Rust driver code under controlled schedules. XRust extends ThreadSanitizer to observe shared-memory accesses and synchronization at runtime and provides lightweight abstractions for the kernel interfaces required by each harness.

(4) We evaluate XRust on ten Rust drivers in Linux kernel 7.3-rc2, covering diverse synchronization mechanisms, including spinlocks, mutexes, and file locks. Across these drivers, XRust enumerates 1,735 pairs of operations that may access the same object and constructs executable harnesses for 1,654 of them. XRust discovers two previously unknown logical races in rnull and Binder. The fix for the rnull logical race has been accepted and applied by the Linux block subsystem maintainer.

References (20)