AZL-118076: CVE-2026-143086 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
sched/core: Fix cpusetmutex double unlock in schedsetscheduler()
A schedsetattr() with SCHEDFLAGKEEPPOLICY on a SCHEDDEADLINE task unlocks cpusetmutex twice if the task's policy changes concurrently:
WARNING: bad unlock balance detected! 7.4.0-rc1 #1 Not tainted ------------------------------------- repro/126 is trying to release lock (cpusetmutex) at: [<ffffffff9a17cacc>] schedsetscheduler+0x9cc/0xc40 but there are no more locks to release! ... Call Trace: printunlockimbalancebug.part.0+0xfb/0x110 lockrelease+0x286/0x2e0 mutexunlockslowpath+0x1a/0x400 schedsetscheduler+0x9cc/0xc40 x64sysschedsetattr+0xa3/0x1b0 dosyscall64+0x106/0x5f0 entrySYSCALL64afterhwframe+0x77/0x7f
schedsetscheduler() samples p->policy before taking any lock, and restarts from the recheck label if p->policy differs under the rq lock. The restart drops cpusetmutex but leaves cpusetlocked set, so a pass that no longer needs the mutex still unlocks it on its way out:
CPU 1 CPU 2 schedsetscheduler(KEEPPOLICY) policy = p->policy / DEADLINE / schedsetscheduler(SCHEDOTHER) p->policy = SCHEDOTHER cpusetlocked = true cpusetlock() rq = taskrqlock(p) oldpolicy != p->policy cpusetunlock() goto recheck / no cpusetlock() this time / ... if (cpusetlocked) cpusetunlock()
Without CONFIGDEBUGMUTEXES, or CONFIGDEBUGRTMUTEXES on PREEMPTRT, nothing warns. The second unlock still clears the owner field regardless of who holds the mutex, so another task can lose cpusetmutex inside its critical section. Entering SCHEDDEADLINE needs CAPSYSNICE, but a racing caller that owns the task does not need it if it samples a policy other than SCHEDDEADLINE.
Clear cpusetlocked when dropping the mutex for the restart. This should be safe because the flag is only tested on the paths leaving the next pass, after that pass has set it again if it took the mutex.
The following program, run as root, reproduces the splat, which no longer appears with this applied. On PREEMPTRT it crashes the kernel within seconds, which this also fixes:
#define GNUSOURCE #include <pthread.h> #include <stdint.h> #include <sys/syscall.h> #include <unistd.h>
struct attr { uint32t size, policy; uint64t flags; int32t nice; uint32t prio; uint64t runtime, deadline, period; };
static volatile int stop; static volatile pidt target;
static void set(struct attr a) { a.size = sizeof(a); syscall(SYSschedsetattr, target, &a, 0); }
static void sleeper(void arg) { target = syscall(SYSgettid); while (!stop) usleep(1000); return arg; }
static void switcher(void arg) { while (!stop) { / SCHEDDEADLINE, 2us every 1s / set((struct attr){ .policy = 6, .runtime = 2000, .deadline = 1000000000, .period = 1000000000 }); set((struct attr){ .policy = 0 }); / SCHEDOTHER / } return arg; }
static void racer(void arg) { / KEEPPOLICY | KEEPPARAMS / while (!stop) set((struct attr){ .flags = 0x18 }); return arg; }
int main(void) { pthreadt t[5]; int i;
pthreadcreate(&t[0], NULL, sleeper, NULL); while (!target) usleep(100); pthreadcreate(&t[1], NULL, switcher, NULL); for (i = 2; i < 5; i++) pthreadcreate(&t[i], NULL, racer, NULL); sleep(30); stop = 1; for (i = 0; i < 5; i++) pthreadjoin(t[i], NULL); return 0; }
An LLM helped find the PREEMPTRT crash and write this patch and its test.
Affected Software
Event History
Frequently Asked Questions
What conditions are required to trigger the double unlock?
A sched_setattr() call using SCHED_FLAG_KEEP_POLICY must target a task using SCHED_DEADLINE, while the task's scheduling policy changes concurrently. The described race occurs when another scheduling operation changes the policy to SCHED_OTHER during processing.
How can I recognize that this issue has occurred?
The kernel may report a bad unlock balance warning involving cpuset_mutex. The example trace identifies __sched_setscheduler() as attempting to release cpuset_mutex when no lock remains to release.