PT-2026-166941

CVE-2026-143086

·

Published

2026-12-03

·

Updated

2026-12-03

Description by

Score
N/A
Not available

No severity ratings or metrics are available. When they are, we'll update the corresponding info on the page.

In the Linux kernel, the following vulnerability has been resolved:
sched/core: Fix cpuset mutex double unlock in sched setscheduler()
A sched setattr() with SCHED FLAG KEEP POLICY on a SCHED DEADLINE task unlocks cpuset mutex 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 (cpuset mutex) at: [] sched setscheduler+0x9cc/0xc40 but there are no more locks to release! ... Call Trace: print unlock imbalance bug.part.0+0xfb/0x110 lock release+0x286/0x2e0 mutex unlock slowpath+0x1a/0x400 sched setscheduler+0x9cc/0xc40 x64 sys sched setattr+0xa3/0x1b0 do syscall 64+0x106/0x5f0 entry SYSCALL 64 after hwframe+0x77/0x7f
sched setscheduler() samples p->policy before taking any lock, and restarts from the recheck label if p->policy differs under the rq lock. The restart drops cpuset mutex but leaves cpuset locked set, so a pass that no longer needs the mutex still unlocks it on its way out:
CPU 1 CPU 2 sched setscheduler(KEEP POLICY) policy = p->policy /* DEADLINE / sched setscheduler(SCHED OTHER) p->policy = SCHED OTHER cpuset locked = true cpuset lock() rq = task rq lock(p) oldpolicy != p->policy cpuset unlock() goto recheck / no cpuset lock() this time */ ... if (cpuset locked) cpuset unlock()
Without CONFIG DEBUG MUTEXES, or CONFIG DEBUG RT MUTEXES on PREEMPT RT, nothing warns. The second unlock still clears the owner field regardless of who holds the mutex, so another task can lose cpuset mutex inside its critical section. Entering SCHED DEADLINE needs CAP SYS NICE, but a racing caller that owns the task does not need it if it samples a policy other than SCHED DEADLINE.
Clear cpuset locked 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 PREEMPT RT it crashes the kernel within seconds, which this also fixes:
#define GNU SOURCE #include <pthread.h> #include <stdint.h> #include <sys/syscall.h> #include <unistd.h>
struct attr { uint32 t size, policy; uint64 t flags; int32 t nice; uint32 t prio; uint64 t runtime, deadline, period; };
static volatile int stop; static volatile pid t target;
static void set(struct attr a) { a.size = sizeof(a); syscall(SYS sched setattr, target, &a, 0); }
static void *sleeper(void *arg) { target = syscall(SYS gettid); while (!stop) usleep(1000); return arg; }
static void *switcher(void arg) { while (!stop) { / SCHED DEADLINE, 2us every 1s / set((struct attr){ .policy = 6, .runtime = 2000, .deadline = 1000000000, .period = 1000000000 }); set((struct attr){ .policy = 0 }); / SCHED OTHER */ } return arg; }
static void *racer(void arg) { / KEEP POLICY | KEEP PARAMS */ while (!stop) set((struct attr){ .flags = 0x18 }); return arg; }
int main(void) { pthread t t[5]; int i;
pthread create(&t[0], NULL, sleeper, NULL); while (!target) usleep(100); pthread create(&t[1], NULL, switcher, NULL); for (i = 2; i < 5; i++) pthread create(&t[i], NULL, racer, NULL); sleep(30); stop = 1; for (i = 0; i < 5; i++) pthread join(t[i], NULL); return 0; }
An LLM helped find the PREEMPT RT crash and write this patch and its test.
Vendors
Affected products
Related identifiers
Found an issue in the description? Have something to add? Feel free to write us 👾