{"id":"CVE-2025-38101","state":"PUBLISHED","title":"ring-buffer: Fix buffer locking in ring_buffer_subbuf_order_set()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nring-buffer: Fix buffer locking in ring_buffer_subbuf_order_set()\n\nEnlarge the critical section in ring_buffer_subbuf_order_set() to\nensure that error handling takes place with per-buffer mutex held,\nthus preventing list corruption and other concurrency-related issues.","publishedAt":"2025-07-03T08:35:10.844Z","updatedAt":"2026-08-05T11:59:32.011Z","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":"f9b94daa542a8d2532f0930f01cd9aec2d19621b","status":"affected","lessThan":"e09c0600beea469b3ebf974464e526a02d59ad62","versionType":"git"},{"version":"f9b94daa542a8d2532f0930f01cd9aec2d19621b","status":"affected","lessThan":"0fc9a295cd8e59c3636e97395e7c74a9c89fee42","versionType":"git"},{"version":"f9b94daa542a8d2532f0930f01cd9aec2d19621b","status":"affected","lessThan":"40ee2afafc1d9fe3aa44a6fbe440d78a5c96a72e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/trace/ring_buffer.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.12.34","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.3","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/trace/ring_buffer.c"]}],"references":["https://git.kernel.org/stable/c/e09c0600beea469b3ebf974464e526a02d59ad62","https://git.kernel.org/stable/c/0fc9a295cd8e59c3636e97395e7c74a9c89fee42","https://git.kernel.org/stable/c/40ee2afafc1d9fe3aa44a6fbe440d78a5c96a72e"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38101.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38101","state":"PUBLISHED","datePublished":"2025-07-03T08:35:10.844Z","dateUpdated":"2026-08-05T11:59:32.011Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.985Z"},"containers":{"cna":{"title":"ring-buffer: Fix buffer locking in ring_buffer_subbuf_order_set()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nring-buffer: Fix buffer locking in ring_buffer_subbuf_order_set()\n\nEnlarge the critical section in ring_buffer_subbuf_order_set() to\nensure that error handling takes place with per-buffer mutex held,\nthus preventing list corruption and other concurrency-related issues."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f9b94daa542a8d2532f0930f01cd9aec2d19621b","status":"affected","lessThan":"e09c0600beea469b3ebf974464e526a02d59ad62","versionType":"git"},{"version":"f9b94daa542a8d2532f0930f01cd9aec2d19621b","status":"affected","lessThan":"0fc9a295cd8e59c3636e97395e7c74a9c89fee42","versionType":"git"},{"version":"f9b94daa542a8d2532f0930f01cd9aec2d19621b","status":"affected","lessThan":"40ee2afafc1d9fe3aa44a6fbe440d78a5c96a72e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/trace/ring_buffer.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.12.34","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.3","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/trace/ring_buffer.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/e09c0600beea469b3ebf974464e526a02d59ad62"},{"url":"https://git.kernel.org/stable/c/0fc9a295cd8e59c3636e97395e7c74a9c89fee42"},{"url":"https://git.kernel.org/stable/c/40ee2afafc1d9fe3aa44a6fbe440d78a5c96a72e"}],"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 - The vulnerable function is reached only through a local `write()` to the tracefs file `buffer_subbuf_size_kb` (via `buffer_subbuf_size_write()`), with the error path armed by a local `mmap()` of `per_cpu/cpuN/trace_pipe_raw`. No remote or network-supplied data reaches `ring_buffer_subbuf_order_set()`.\nAC:L - The attacker owns both sides of the race — two threads writing `buffer_subbuf_size_kb` concurrently, with no `trace_types_lock` serializing `buffer_subbuf_size_write()` — and deterministically forces the unlocked `error:` path by mmap'ing a later CPU's `trace_pipe_raw` so `cpu_buffer->mapped` yields `-EBUSY` after earlier CPUs already allocated `new_pages`. The window spans a sleeping GFP_KERNEL allocation loop and a multi-page free loop whose length the attacker sets via `buffer_size_kb` and CPU count, and the attempt can be retried indefinitely.\nPR:L - No capability check exists anywhere on the path — `tracing_check_open_get_tr()` only tests `LOCKDOWN_TRACEFS` and `tracing_disabled` — so access is governed purely by tracefs DAC, which Android (`shell`, `traced_probes`/Perfetto), ChromeOS and observability/embedded deployments routinely delegate to ordinary non-root accounts and tracing groups. This matches the CNA's existing tracefs precedent (CVE-2025-38267, CVE-2025-68329, both PR:L).\nUI:N - The attacker performs the `mmap()` of `trace_pipe_raw` and both concurrent writes to `buffer_subbuf_size_kb` entirely from its own threads. No victim action, mount, or file open by another user is involved.\nS:U - The list corruption and freed-page reuse occur in the kernel's own ring-buffer allocations and stay within the host kernel's security authority. No VM, IOMMU, container, or sandbox boundary is crossed.\nC:H - The race leaves the live `cpu_buffer->pages` list pointing at `struct buffer_page` objects and order-N data pages that the other thread has already handed back via `kfree()`/`free_pages()`, so the ring buffer keeps reading from memory that the slab and page allocators have reissued to other kernel users. Reading `trace` or `trace_pipe_raw` then discloses the contents of those reallocated kernel objects.\nI:H - Concurrent `list_del_init()` against a re-initialized head produces list corruption plus double-free of both a kmalloc'd `struct buffer_page` and its `free_pages()` backing allocation — a classic heap-corruption primitive. Because `trace_marker` writes attacker-chosen bytes directly into ring-buffer data pages, the attacker can overwrite the freed-and-reallocated memory with controlled content, giving a write primitive usable for control-flow hijack.\nA:H - The corrupted linked list and double-free reliably oops the kernel — immediately under `CONFIG_DEBUG_LIST`, which turns the bad `__list_del_entry()` into a BUG, and otherwise through the subsequent `rb_check_pages()`/`rb_head_page_deactivate()` walk over freed pages. This was the syzbot-reported failure mode and the attacker can repeat it at will."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:59:32.011Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.12.34"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.15.3"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}