CVE-2026-143086: sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler()

Published Dec 3, 2026
·
Updated

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

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler()

Event History

Dec 3, 2026
CVE Published
via MITRE·09:19 AM
Data Sourced
via MITRE·09:19 AM
Description

Frequently Asked Questions

1

What conditions are required to trigger the issue?

One task must call sched_setattr() with SCHED_FLAG_KEEP_POLICY while the target task has SCHED_DEADLINE policy. Another concurrent scheduler-policy change must cause the target policy to change during the operation, such as a change to SCHED_OTHER.

2

What evidence would indicate that a system has encountered this bug?

The kernel may emit a "WARNING: bad unlock balance detected!" message reporting that a task is trying to release cpuset_mutex when no locks remain to release. The stack trace includes __sched_setscheduler(), __x64_sys_sched_setattr(), and mutex unlock functions.

3

Is a fix available?

The issue is described as resolved, and the supplied references point to stable kernel commits containing the fix. The provided data does not identify affected or fixed kernel version numbers.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203