KCSAN: data-race in device_suspend_noirq / device_suspend_noirq

Status: moderation: reported on 2026/11/19 00:06
Subsystems: driver-core pm
Labels: prio:low race:benign
[Documentation on labels]
Reported-by: syzbot+44f4dd40cb21a8443d61@syzkaller.appspotmail.com
First crash: 1d20h, last: 1d08h
✨ AI-generated root cause summary:

In dpm_superior_set_must_resume() (drivers/base/power/main.c), the power management core marks superior devices (parent and suppliers) with power.must_resume = true during device_suspend_noirq() without acquiring dev->parent->power.lock or supplier->power.lock. Because must_resume is a 1-bit bitfield in struct dev_pm_info packed into a shared byte with other flags, concurrent asynchronous suspension of sibling or co-consumer devices leads to an unsynchronized 1-byte read-modify-write data race on the superior device's power.must_resume field.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 666539eecdf4:

Technical Explanation and Root Cause Analysis

1. Functions, Structs, Fields, and Files Involved

  • Source Files:
  • Structures and Fields:
    • struct dev_pm_info:
      • bool must_resume:1; (bitfield at bit offset 588, byte offset 73 / 0x49).
      • spinlock_t lock; (per-device power management spinlock).
    • Superior devices: dev->parent->power and link->supplier->power.

2. Root Cause Mechanism

During system sleep transitions in the "noirq suspend" phase (dpm_noirq_suspend_devices()), subordinate/leaf devices marked for asynchronous suspend run concurrently across multiple asynchronous worker threads (async_run_entry_fn() $\to$ async_suspend_noirq() $\to$ device_suspend_noirq()).

When each subordinate device completes its noirq suspend callback and determines that it must be resumed (dev->power.must_resume == true), it propagates this requirement up the hierarchy by invoking dpm_superior_set_must_resume(dev):

static void dpm_superior_set_must_resume(struct device *dev)
{
	struct device_link *link;
	int idx;

	if (dev->parent)
		dev->parent->power.must_resume = true;

	idx = device_links_read_lock();

	dev_for_each_link_to_supplier(link, dev)
		link->supplier->power.must_resume = true;

	device_links_read_unlock(idx);
}
  1. Missing Mutual Exclusion: Unlike analogous superior-update helpers in drivers/base/power/main.c (such as dpm_clear_superiors_direct_complete(), which acquires spin_lock_irq(&dev->parent->power.lock) and spin_lock_irq(&link->supplier->power.lock), or dpm_propagate_wakeup_to_parent(), which acquires spin_lock_irq(&parent->power.lock)), dpm_superior_set_must_resume() updates dev->parent->power.must_resume and link->supplier->power.must_resume without acquiring power.lock. device_links_read_lock() only takes an SRCU read lock (device_links_srcu) to safely traverse the links, providing no writer mutual exclusion.

  2. Bitfield Read-Modify-Write: In struct dev_pm_info under CONFIG_PM_SLEEP, must_resume:1 is a single-bit bitfield packed into byte offset 73 alongside:

    • wakeup_path:1
    • syscore:1
    • no_pm_callbacks:1
    • smart_suspend:1
    • must_resume:1
    • may_skip_resume:1
    • out_band_wakeup:1
    • strict_midlayer:1

    Bitfield stores are non-atomic read-modify-write (RMW) operations on the containing byte. When multiple sibling devices or co-consumers suspend asynchronously on separate CPU cores, both tasks execute an unlocked 1-byte read-modify-write at the exact same address of their common parent or supplier (reported by KCSAN as read-write to 0xffff88810265b579 of 1 bytes in device_suspend_noirq).

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
6d19d229 assessment-kcsan Benign: ✅ ❓ KCSAN: data-race in device_suspend_noirq / device_suspend_noirq 2026/11/18 16:18 2026/11/18 16:18 2026/11/18 17:12 2006bdcc
167ea729 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ KCSAN: data-race in device_suspend_noirq / device_suspend_noirq 2026/11/18 16:13 2026/11/18 16:13 2026/11/18 16:38 2006bdcc

Sample crash report:
==================================================================
BUG: KCSAN: data-race in device_suspend_noirq / device_suspend_noirq

read-write to 0xffff88810265b579 of 1 bytes by task 16452 on cpu 0:
 dpm_superior_set_must_resume drivers/base/power/main.c:1497 [inline]
 device_suspend_noirq+0x5e3/0x900 drivers/base/power/main.c:1584
 async_suspend_noirq+0x2c/0x40 drivers/base/power/main.c:1603
 async_run_entry_fn+0x52/0x190 kernel/async.c:129
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
 worker_thread+0x56c/0x770 kernel/workqueue.c:3659
 kthread+0x248/0x2a0 kernel/kthread.c:436
 ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

read-write to 0xffff88810265b579 of 1 bytes by task 358 on cpu 1:
 dpm_superior_set_must_resume drivers/base/power/main.c:1497 [inline]
 device_suspend_noirq+0x5e3/0x900 drivers/base/power/main.c:1584
 async_suspend_noirq+0x2c/0x40 drivers/base/power/main.c:1603
 async_run_entry_fn+0x52/0x190 kernel/async.c:129
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
 worker_thread+0x56c/0x770 kernel/workqueue.c:3659
 kthread+0x248/0x2a0 kernel/kthread.c:436
 ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 358 Comm: kworker/u8:6 Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Workqueue: async async_run_entry_fn
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/17 16:34 upstream 666539eecdf4 43af6cac .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in device_suspend_noirq / device_suspend_noirq
2026/11/17 04:50 upstream 666539eecdf4 a3e64cfc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in device_suspend_noirq / device_suspend_noirq
* Struck through repros no longer work on HEAD.