CVE-2026-143114: cgroup: arm the notify timer only while the file exists
In the Linux kernel, the following vulnerability has been resolved:
cgroup: arm the notify timer only while the file exists
cgrouprmfile() clears cfile->kn under cfile->lock and then deletes the notify timer. Since commit 4616120fca7f ("cgroup: add lockless fast-path checks to cgroupfilenotify()"), cgroupfilenotify() checks kn and arms the timer without that lock and can arm it right after it was deleted:
Task A (memcg charge) Task B (subtreecontrol write) cgroupfilenotify() READONCE(cfile->kn) != NULL cgrouprmfile() cfile->kn = NULL timerdeletesync() timerreduce(&cfile->notifytimer) / timer queued again /
If the css is only hidden, showing it again runs timersetup() on the still queued timer and corrupts the timer wheel:
[ 14.324093] ODEBUG: init active (active state 0) object: 0000000009e526fd object type: timerlist hint: cgroupfilenotifytimer+0x0/0x10 [ 14.324123] WARNING: lib/debugobjects.c:629 at debugprintobject+0x1a4/0x3b0, CPU#1: cgnotify/64 [ 14.329806] CPU: 1 UID: 0 PID: 64 Comm: cgnotify Tainted: G W 7.3.0-17087-gd865f2677c44 #1 PREEMPT [ 14.335109] RIP: 0010:debugprintobject+0x1ae/0x3b0 [ 14.354351] Call Trace: [ 14.354927] <TASK> [ 14.356650] debugobjectinit+0x203/0x3c0 [ 14.361799] timerinitkey+0x2c/0x240 [ 14.362682] cgroupaddrmfiles+0x754/0xc40 [ 14.366744] csspopulatedir+0x12e/0x440 [ 14.368636] cgroupapplycontrolenable+0x2f3/0xb60 [ 14.371769] cgroupsubtreecontrolwrite+0x740/0xc10 [ 14.376924] cgroupfilewrite+0x19e/0x700 [ 14.381809] kernfsfopwriteiter+0x337/0x510 [ 14.382818] vfswrite+0x545/0x1250 [ 14.386491] ksyswrite+0xfa/0x200 [ 14.390144] dosyscall64+0xfb/0x590 [ 14.390994] entrySYSCALL64afterhwframe+0x77/0x7f
If the css is freed instead, the timer can fire on freed memory.
Arm the timer under cfile->lock after checking kn again and keep only the kn and timerpending() checks outside the lock. With the fix, the timer stays idle once the file is removed.
This bug was identified and confirmed with the help of a deterministic hypervisor currently under development. The C reproducer below however hits it within a minute.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In cgroup_file_notify(), take cfile->lock, recheck cfile->kn, and arm the notify timer only while the file exists; keep the kn and timer_pending() checks outside the lock only as fast-path checks.
Event History
Frequently Asked Questions
What conditions are required to trigger the race?
One task must call cgroup_file_notify() while another removes the corresponding cgroup file through cgroup_rm_file(). The issue can occur when cgroup_file_notify() observes a non-NULL kn pointer, the file is then removed and its notify timer deleted, and the first task subsequently requeues that timer.
How might an affected system present the issue?
If the associated css is hidden and later shown again, timer_setup() can run on a timer that remains queued, corrupting the timer wheel. Kernel diagnostics may include an ODEBUG "init active" message for a timer_list and a warning from lib/debugobjects.c referencing cgroup_file_notify_timer.