{"id":"CVE-2025-38012","state":"PUBLISHED","title":"sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nsched_ext: bpf_iter_scx_dsq_new() should always initialize iterator\n\nBPF programs may call next() and destroy() on BPF iterators even after new()\nreturns an error value (e.g. bpf_for_each() macro ignores error returns from\nnew()). bpf_iter_scx_dsq_new() could leave the iterator in an uninitialized\nstate after an error return causing bpf_iter_scx_dsq_next() to dereference\ngarbage data. Make bpf_iter_scx_dsq_new() always clear $kit->dsq so that\nnext() and destroy() become noops.","publishedAt":"2025-06-18T09:28:22.057Z","updatedAt":"2026-08-05T11:58:57.764Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"650ba21b131ed1f8ee57826b2c6295a3be221132","status":"affected","lessThan":"0102989af4c334d1d98b2a0fd4d61a5152e39b72","versionType":"git"},{"version":"650ba21b131ed1f8ee57826b2c6295a3be221132","status":"affected","lessThan":"255dd31bfc4a67a19b1fc2cd130a50284dadfe3a","versionType":"git"},{"version":"650ba21b131ed1f8ee57826b2c6295a3be221132","status":"affected","lessThan":"428dc9fc0873989d73918d4a9cc22745b7bbc799","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/ext.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.30","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.14.8","status":"unaffected","lessThanOrEqual":"6.14.*","versionType":"semver"},{"version":"6.15","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/ext.c"]}],"references":["https://git.kernel.org/stable/c/0102989af4c334d1d98b2a0fd4d61a5152e39b72","https://git.kernel.org/stable/c/255dd31bfc4a67a19b1fc2cd130a50284dadfe3a","https://git.kernel.org/stable/c/428dc9fc0873989d73918d4a9cc22745b7bbc799"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38012.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38012","state":"PUBLISHED","datePublished":"2025-06-18T09:28:22.057Z","dateUpdated":"2026-08-05T11:58:57.764Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.977Z"},"containers":{"cna":{"title":"sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nsched_ext: bpf_iter_scx_dsq_new() should always initialize iterator\n\nBPF programs may call next() and destroy() on BPF iterators even after new()\nreturns an error value (e.g. bpf_for_each() macro ignores error returns from\nnew()). bpf_iter_scx_dsq_new() could leave the iterator in an uninitialized\nstate after an error return causing bpf_iter_scx_dsq_next() to dereference\ngarbage data. Make bpf_iter_scx_dsq_new() always clear $kit->dsq so that\nnext() and destroy() become noops."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"650ba21b131ed1f8ee57826b2c6295a3be221132","status":"affected","lessThan":"0102989af4c334d1d98b2a0fd4d61a5152e39b72","versionType":"git"},{"version":"650ba21b131ed1f8ee57826b2c6295a3be221132","status":"affected","lessThan":"255dd31bfc4a67a19b1fc2cd130a50284dadfe3a","versionType":"git"},{"version":"650ba21b131ed1f8ee57826b2c6295a3be221132","status":"affected","lessThan":"428dc9fc0873989d73918d4a9cc22745b7bbc799","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/ext.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.30","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.14.8","status":"unaffected","lessThanOrEqual":"6.14.*","versionType":"semver"},{"version":"6.15","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/sched/ext.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/0102989af4c334d1d98b2a0fd4d61a5152e39b72"},{"url":"https://git.kernel.org/stable/c/255dd31bfc4a67a19b1fc2cd130a50284dadfe3a"},{"url":"https://git.kernel.org/stable/c/428dc9fc0873989d73918d4a9cc22745b7bbc799"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - Exploitation requires loading and running a BPF program via the local `bpf()` syscall (BPF_PROG_LOAD + BPF_PROG_TEST_RUN, or a struct_ops/tracing attach). There is no remote or adjacent-network path to the sched_ext DSQ iterator kfuncs.\nAC:L - The trigger is fully deterministic — pass an invalid flag bit to `bpf_iter_scx_dsq_new()` and call `next()` — with no race, no timing window, and no dependence on ambient memory layout, since the attacker pre-seeds the iterator stack slots with values of their choosing. `CONFIG_SCHED_CLASS_EXT` is enabled in mainstream 6.12+ distro kernels.\nPR:L - Only CAP_BPF is needed: the iterator kfuncs are registered for `BPF_PROG_TYPE_SYSCALL`, which is not perfmon/net-admin gated, and `bpf_prog_test_run_syscall()` adds no capability check. `bpf_token_capable()` allows CAP_BPF to be delegated into an unprivileged user namespace via a bpffs BPF token, so an ordinary low-privileged container user can reach it.\nUI:N - The attacker's own BPF program triggers the flaw synchronously; no victim action, mount, or file open is involved.\nS:U - The corruption and its consequences are confined to the kernel's own security authority — a standard local privilege escalation with no VM, IOMMU, or hypervisor boundary crossed.\nC:H - `nldsq_next_task()` dereferences the attacker-supplied `kit->dsq` pointer and then walks arbitrary `list_head` next/prev chains, yielding an arbitrary kernel-memory read primitive that can disclose credentials, keys, and KASLR state.\nI:H - The uninitialized `kit->cursor` drives `list_move()`/`list_del_init()` against attacker-chosen addresses, and `raw_spin_lock_irqsave(&kit->dsq->lock)` performs a read-modify-write at an arbitrary address — a controlled kernel write primitive leading to full privilege escalation.\nA:H - Dereferencing garbage pointers under `raw_spin_lock_irqsave()` reliably produces a kernel oops or a hard lockup on a bogus spinlock, and any unprivileged-BPF-capable process can repeat it at will to panic the machine."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:58:57.764Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.12.30"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.14.8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.15"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}