syzbot
KCSAN: data-race in fast_dput / lockref_put_return
Status:
moderation: reported on 2026/11/19 00:01
Subsystems:
fs
Labels:
prio:low
race:benign
[Documentation on labels]
Reported-by: syzbot+1e521f930ff53c1d0b63@syzkaller.appspotmail.com
First crash: 1d21h, last: 56m
✨ AI-generated root cause summary:
A data race occurs between fast_dput() and lockref_put_return() due to mixed marked and unmarked concurrent accesses to struct lockref. In fast_dput(), if an optimistic lockless decrement fails (e.g., ret < 0), the kernel acquires dentry->d_lock and performs a plain, unmarked decrement on dentry->d_lockref.count. Concurrently, another task in fast_dput() executes lockref_put_return(), which performs a marked 8-byte READ_ONCE() of lockref->lock_count (which aliases both lock and count in struct lockref). Under the Linux Kernel Memory Model (LKMM), a concurrent unmarked write racing with a marked read of overlapping bytes triggers a KCSAN data-race report.
▶
▼
✨ Full AI root cause analysis
Root Cause Analysis
1. Components and Data Structures Involved
struct lockref (include/linux/lockref.h:25-35):
On 64-bit SMP architectures supporting CONFIG_ARCH_USE_CMPXCHG_LOCKREF, struct lockref is defined as a union of an 8-byte field aligned_u64 lock_count and a struct containing a 4-byte spinlock spinlock_t lock followed by a 4-byte integer int count.
struct dentry (include/linux/dcache.h:89,114):
dentry->d_lockref stores the per-dentry lock and refcount, with dentry->d_lock defined as an alias for dentry->d_lockref.lock.
fast_dput() (fs/dcache.c:960-1027) and lockref_put_return() (lib/lockref.c:90-101).
2. Mechanism of the Bug and Reported Failure
-
Task 16780 (CPU 0) executes dput() → fast_dput() → lockref_put_return(&dentry->d_lockref):
-
Task 2981 (CPU 1) executes dput() → fast_dput() on the same dentry:
-
Data Race Trigger:
- Task 16780's 8-byte marked read of
lockref->lock_count overlaps in memory with Task 2981's 4-byte unmarked write to lockref->count.
- Under the Linux Kernel Memory Model (LKMM) and C concurrency rules, accessing the same or overlapping memory location concurrently with at least one write where one access is marked (
READ_ONCE) and the other is unmarked (plain count--) constitutes a data race, which is detected and reported by KCSAN.
3. Invariants and Architectural Guarantees
Although flagged as a formal data race by KCSAN:
Sample crash report:
* Struck through repros no longer work on HEAD.