AZL-118079: CVE-2026-143087 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
sched/uclamp: Reject clamp values above SCHEDCAPACITYSCALE
schedsetattr() accepts schedutilmin and schedutilmax values that do not fit in uclampse::value. A single thread can do:
schedsetattr(max = 800) returns 0 schedsetattr(min = 0xfffffffe) returns 0 schedgetattr() min=2046 max=800
which leaves the minimum above both SCHEDCAPACITYSCALE and the task's own maximum.
The range check in uclampvalidate() relies on the + 1 wrapping -1, the reset value, to 0:
if (utilmin + 1 > SCHEDCAPACITYSCALE + 1)
That only works for an unsigned type. utilmin and utilmax are int and SCHEDCAPACITYSCALE is a long, so every negative value passes the check, and so does INTMAX, whose + 1 wraps.
uclampseset() then truncates what got through to the 11 bits of uclampse::value, but computes the bucket from the full value. A minimum of 0xfffff800 is stored as 0 in the top bucket, where uclamprqmaxvalue() takes it for the highest active clamp once a higher value leaves the rq. The rq clamp falls below what the remaining tasks requested, and emptying their bucket trips the WARNONONCE() in uclamprqdecid(), without any privilege:
WARNING: kernel/sched/core.c:1862 at dequeuetask+0x2a3/0x2b0, CPU#0: repro/126 Call Trace: schedule+0x933/0x1320 schedule+0x36/0x100 donanosleep+0x61/0x190 hrtimernanosleep+0xb5/0x1d0
Make utilmin and utilmax unsigned int, so that -1 is the only value that wraps. The pair check below is unaffected, since it skips -1 explicitly and anything else is at most SCHEDCAPACITYSCALE by then.
Requests that were only accepted because of this now fail with -EINVAL.
The following program triggers the warning when run by any user outside a child cpu cgroup. With this applied, its 0xfffff800 request fails with -EINVAL and the warning no longer appears:
#define GNUSOURCE #include <pthread.h> #include <sched.h> #include <stdint.h> #include <sys/syscall.h> #include <time.h> #include <unistd.h>
struct attr { uint32t size, policy; uint64t flags; int32t nice; uint32t prio; uint64t runtime, deadline, period; uint32t utilmin, utilmax; };
static volatile int stop;
static void setmin(uint32t v) { / KEEPPOLICY | KEEPPARAMS | UTILCLAMPMIN / struct attr a = { .size = sizeof(a), .flags = 0x38, .utilmin = v };
syscall(SYSschedsetattr, 0, &a, 0); }
static void burn(long us) { struct timespec s, n;
clockgettime(CLOCKMONOTONIC, &s); do clockgettime(CLOCKMONOTONIC, &n); while ((n.tvsec - s.tvsec) 1000000 + (n.tvnsec - s.tvnsec) / 1000 < us); }
static void bogus(void arg) { setmin(0xfffff800); while (!stop) burn(1000); return arg; }
static void worker(void arg) { long v = (long)arg;
setmin(v); while (!stop) { burn(v == 800 ? 300 : 1500); usleep(100); } return arg; }
int main(void) { pthreadt t[3]; cpusett c; int i;
CPUZERO(&c); CPUSET(0, &c); schedsetaffinity(0, sizeof(c), &c); pthreadcreate(&t[0], NULL, bogus, NULL); usleep(50000); pthreadcreate(&t[1], NULL, worker, (void )500L); pthreadcreate(&t[2], NULL, worker, (void )800L); sleep(15); stop = 1; for (i = 0; i < 3; i++) pthreadjoin(t[i], NULL); return 0; }
An LLM helped find the warning and write this patch and its tests.
Affected Software
Event History
Frequently Asked Questions
What scheduler inputs can trigger the inconsistent clamp state?
The issue occurs when sched_setattr() accepts sched_util_min or sched_util_max values outside SCHED_CAPACITY_SCALE, including negative values and INT_MAX. The example sequence sets max to 800 and then min to 0xfffffffe, after which sched_getattr() reports min=2046 and max=800.
How can I identify a system or workload that has reached the bad state?
Affected behavior can be observed when sched_getattr() returns a minimum clamp value above SCHED_CAPACITY_SCALE or above the task’s own maximum clamp. The described example produces min=2046 with max=800; emptying the affected bucket can also trigger WARN_ON_ONCE() in uclamp_rq_dec_id().
What is the operational effect of malformed clamp values?
uclamp_se_set() truncates the accepted value for storage but calculates the bucket using the full value. This can cause the runqueue clamp to fall below the values requested by remaining tasks after a higher clamp leaves the runqueue.