KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async

Status: moderation: reported on 2026/11/17 10:58
Subsystems: kernel
Labels: prio:low race:benign
[Documentation on labels]
Reported-by: syzbot+c6b475cea1b4c8275149@syzkaller.appspotmail.com
First crash: 1d09h, last: 5h45m
✨ AI cause bisection: candidate commits (most relevant first) (AI job):
commit 5a18ceca63502546d6c0cab1f3f79cb6900f947a
Author: Peter Xu <peterx@redhat.com>
Date: Mon Dec 16 21:31:23 2019 +0000

  smp: Allow smp_call_function_single_async() to insert locked csd

commit fd3eafda8f146d4ad8f95f91a8c2b9a5319ff6b2
Author: Peter Xu <peterx@redhat.com>
Date: Mon Dec 16 21:31:25 2019 +0000

  sched/core: Remove rq.hrtick_csd_pending

commit 9213aa4784cf4e63e6d8d30ba71fd61c3d110247
Author: Peter Zijlstra <peterz@infradead.org>
Date: Tue Feb 24 16:39:08 2026 +0000

  sched: Default enable HRTICK when deferred rearming is enabled
  
✨ AI-generated root cause summary:

In smp_call_function_single_async() (kernel/smp.c), the check for whether the call-single-data object is currently locked (csd->node.u_flags & CSD_FLAG_LOCK) performs an unmarked, plain memory read. While callers serialize submissions of a shared CSD using external locking (such as rq->lock for rq->hrtick_csd), they cannot serialize against the remote target CPU asynchronously completing the IPI in __flush_smp_call_function_queue(), which invokes csd_unlock() using smp_store_release(&csd->node.u_flags, 0). The unmarked read in smp_call_function_single_async() races with the release store in csd_unlock(), lacking acquire semantics to properly synchronize with the remote CPU and triggering a KCSAN data-race report.

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

Technical Root Cause Analysis

1. Involved Functions, Structs, and Files


2. Triggering Mechanism and Race Lifecycle

smp_call_function_single_async() allows callers to queue an asynchronous cross-CPU IPI callback using a caller-managed, preallocated call_single_data_t (csd). As documented in its function header (kernel/smp.c:805-812), the caller is responsible for synchronizing submissions on the given csd object so that calls are serialized among submitters. If a previously submitted call is still in progress on the target CPU, smp_call_function_single_async() returns -EBUSY.

In this report, the shared csd is &rq->hrtick_csd belonging to CPU 0:

  1. Submitter Context (CPU 1):

    • CPU 1 activates or wakes a task belonging to CPU 0 (try_to_wake_up() $\rightarrow$ ttwu_queue() $\rightarrow$ ttwu_do_activate() $\rightarrow$ activate_task() $\rightarrow$ enqueue_task() $\rightarrow$ enqueue_task_fair() $\rightarrow$ hrtick_update() $\rightarrow$ hrtick_start_fair() $\rightarrow$ hrtick_start()).
    • Callers of hrtick_start() hold CPU 0's runqueue lock (rq->__lock), strictly serializing submissions on rq->hrtick_csd.
    • In hrtick_start(), because rq != this_rq(), it calls:
      smp_call_function_single_async(cpu_of(rq), &rq->hrtick_csd);
      
    • In smp_call_function_single_async() (kernel/smp.c:825):
      if (csd->node.u_flags & CSD_FLAG_LOCK) {
          err = -EBUSY;
          goto out;
      }
      
      csd->node.u_flags = CSD_FLAG_LOCK;
      smp_wmb();
      
      err = generic_exec_single(cpu, csd);
      
      Line 825 performs a plain, unmarked memory read of csd->node.u_flags.
  2. IPI Handler Context (CPU 0):

    • CPU 0 is handling a previously queued SMP call function interrupt via generic_smp_call_function_single_interrupt() $\rightarrow$ __flush_smp_call_function_queue().
    • When processing a CSD_TYPE_ASYNC item, CPU 0 unlocks the CSD via csd_unlock(csd) (kernel/smp.c:657):
      static __always_inline void csd_unlock(call_single_data_t *csd)
      {
          WARN_ON(!(csd->node.u_flags & CSD_FLAG_LOCK));
          smp_store_release(&csd->node.u_flags, 0);
      }
      
      This executes a marked release write to csd->node.u_flags (kernel/smp.c:441).

3. Violated Synchronization and Memory Invariant

While submitters serialize with each other using external locks (rq->__lock), they cannot hold locks that serialize against __flush_smp_call_function_queue(), which runs asynchronously in interrupt context on the target CPU. Checking whether the previous async request has finished requires inspecting csd->node.u_flags.

  • csd_unlock() writes 0 using smp_store_release(&csd->node.u_flags, 0) so that prior reads of csd->func, csd->info, and list nodes are ordered before clearing CSD_FLAG_LOCK.
  • Conversely, smp_call_function_single_async() reads csd->node.u_flags with a plain, unmarked load at line 825, followed by a plain store at line 830 (csd->node.u_flags = CSD_FLAG_LOCK).
  • The plain load constitutes an unsynchronized, unmarked read concurrent with a marked write (smp_store_release), directly violating LKMM rules and triggering KCSAN. Furthermore, it lacks acquire semantics (such as smp_load_acquire(&csd->node.u_flags) or try_cmpxchg_acquire()), failing to establish a formal acquire-release pairing with csd_unlock() before reusing the csd node.
▶ ▼ ✨ AI Jobs (3)
ID Workflow Result Correct Bug Created Started Finished Revision
a5eea656 assessment-kcsan Benign: ✅ ❓ KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async 2026/11/17 10:57 2026/11/17 10:57 2026/11/17 11:31 a3e64cfc
478a6320 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ✅ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async 2026/11/17 10:50 2026/11/17 10:50 2026/11/17 10:57 a3e64cfc
5e5e426b bisect-cause ❓ KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async 2026/11/17 10:11 2026/11/17 10:11 2026/11/17 11:16 a3e64cfc

Sample crash report:
veth0_vlan: entered promiscuous mode
veth1_vlan: entered promiscuous mode
==================================================================
BUG: KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async

write (marked) to 0xffff888237d2cc08 of 4 bytes by interrupt on cpu 1:
 csd_unlock kernel/smp.c:441 [inline]
 __flush_smp_call_function_queue+0x47b/0x900 kernel/smp.c:657
 generic_smp_call_function_single_interrupt+0x13/0x20 kernel/smp.c:544
 __sysvec_call_function_single+0x24/0x120 arch/x86/kernel/smp.c:272
 instr_sysvec_call_function_single arch/x86/kernel/smp.c:267 [inline]
 sysvec_call_function_single+0x66/0x80 arch/x86/kernel/smp.c:267
 asm_sysvec_call_function_single+0x1a/0x20 arch/x86/include/asm/idtentry.h:681
 __preempt_count_dec_and_test arch/x86/include/asm/preempt.h:123 [inline]
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
 _raw_spin_unlock_irqrestore+0x1a/0x30 kernel/locking/spinlock.c:221
 spin_unlock_irqrestore include/linux/spinlock.h:425 [inline]
 pcpu_alloc_noprof+0x759/0xfc0 mm/percpu.c:1871
 mm_alloc_cid_noprof include/linux/mm_types.h:1631 [inline]
 mm_init+0x534/0x6d0 kernel/fork.c:1140
 mm_alloc+0x53/0x70 kernel/fork.c:1180
 bprm_mm_init fs/exec.c:263 [inline]
 alloc_bprm+0x246/0x470 fs/exec.c:1570
 class_bprm_constructor fs/exec.c:1580 [inline]
 kernel_execve+0x6a/0x660 fs/exec.c:1976
 call_usermodehelper_exec_async+0x196/0x260 kernel/umh.c:107
 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 to 0xffff888237d2cc08 of 4 bytes by task 3299 on cpu 0:
 smp_call_function_single_async+0x28/0xb0 kernel/smp.c:825
 enqueue_task kernel/sched/core.c:2197 [inline]
 activate_task kernel/sched/core.c:2237 [inline]
 ttwu_do_activate+0x65/0x210 kernel/sched/core.c:3903
 ttwu_queue kernel/sched/core.c:4156 [inline]
 try_to_wake_up+0x3f8/0x6b0 kernel/sched/core.c:4489
 __mutex_unlock_slowpath+0x26a/0x3b0 kernel/locking/mutex.c:1077
 mutex_unlock+0x93/0xa0 kernel/locking/mutex.c:582
 __rtnl_unlock+0x56/0xb0 net/core/rtnetlink.c:143
 netdev_run_todo+0xb6/0xb00 net/core/dev.c:12013
 rtnl_unlock+0xe/0x20 net/core/rtnetlink.c:157
 rtnl_net_unlock include/linux/rtnetlink.h:139 [inline]
 inet6_rtm_newaddr+0x983/0x9f0 net/ipv6/addrconf.c:5137
 rtnetlink_rcv_msg+0x64b/0x720 net/core/rtnetlink.c:7169
 netlink_rcv_skb+0x11e/0x220 net/netlink/af_netlink.c:2585
 rtnetlink_rcv+0x1c/0x30 net/core/rtnetlink.c:7196
 netlink_unicast_kernel net/netlink/af_netlink.c:1336 [inline]
 netlink_unicast+0x6fd/0x7e0 net/netlink/af_netlink.c:1362
 netlink_sendmsg+0x605/0x760 net/netlink/af_netlink.c:1921
 sock_sendmsg_nosec net/socket.c:800 [inline]
 __sock_sendmsg net/socket.c:818 [inline]
 __sys_sendto+0x429/0x480 net/socket.c:2283
 __do_sys_sendto net/socket.c:2290 [inline]
 __se_sys_sendto net/socket.c:2286 [inline]
 __x64_sys_sendto+0x76/0x90 net/socket.c:2286
 x64_sys_call+0x200c/0x2550 arch/x86/include/generated/asm/syscalls_64.h:45
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x00000001 -> 0x00000000

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 3299 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================
veth0_macvtap: entered promiscuous mode
veth1_macvtap: entered promiscuous mode
batman_adv: batadv0: Interface activated: batadv_slave_0
batman_adv: batadv0: Interface activated: batadv_slave_1

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/18 07:41 upstream 20eef29b7c84 eb4895d7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async
2026/11/17 23:04 upstream 63fdb511c27a 122f94d5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async
2026/11/17 19:55 upstream 666539eecdf4 122f94d5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async
2026/11/17 10:40 upstream 666539eecdf4 43af6cac .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async
2026/11/17 04:07 upstream 666539eecdf4 a3e64cfc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_smp_call_function_queue / smp_call_function_single_async
* Struck through repros no longer work on HEAD.