freenode
Kernel & Low-Level

Kernel reverts IRQ guard switch after Syzbot finds nested lock hazards

Refcounted interrupt disable lands for safer nesting and Rust SpinLockIrq, but wiring it into scoped cleanup guards is rolled back until stronger tooling exists.

A Linux kernel series that adds refcounted local interrupt disable and enable primitives has partially landed in the tip locking tree, then immediately lost one of its most visible integration points after automated fuzzing exposed how existing C code misbehaves under the new rules.

Boqun Feng, with contributions from Lyude Paul and others, introduced counted interrupt disabling so nested critical sections no longer depend solely on irqsave/irqrestore flag pairs. Those pairs can re-enable interrupts too early when locks are acquired and released out of order, a pattern that is awkward to wrap safely from Rust. Matching spin-lock helpers and a Rust SpinLockIrq type ride on the same model, with KUnit coverage for the refcount behavior.

Peter Zijlstra merged the bulk of the work, then reverted the change that rewired scoped IRQ spinlock guards to the new disable/enable helpers. Syzbot hit posix_timer_delete() doing unlock-then-relock with the classic IRQ spinlock APIs inside a scoped_guard(spinlock_irq). Under refcounted nesting that combination fails hard. Similar awkwardness already existed in scheduler timer paths. Zijlstra left the rest of the series in place and said stronger debug or tooling is required before trying the guard conversion again.

Thomas Gleixner argued against incremental detection of such sites. He wants a wholesale conversion of every path that changes CPU interrupt-disabled state, direct or via locks, calling anything less a whack-a-mole game, and criticized burying a known scheduler fix inside the guard switch. Feng replied that a single flag-day conversion is unrealistic while unpaired disable/enable pairs and intentional unlock/relock patterns remain, and sketched scoped-guard drop/retake tokens so inner unlocks cannot double-release on early return.

The practical outcome is that refcounted IRQ disable is in locking/core for new and careful users, including the Rust side, while automatic cleanup guards stay on the old semantics until the ecosystem can catch mixed nesting safely.