{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-36001","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2024-05-17T13:50:33.149Z","datePublished":"2024-05-20T09:48:02.966Z","dateUpdated":"2026-08-05T11:31:31.727Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T11:31:31.727Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetfs: Fix the pre-flush when appending to a file in writethrough mode\n\nIn netfs_perform_write(), when the file is marked NETFS_ICTX_WRITETHROUGH\nor O_*SYNC or RWF_*SYNC was specified, write-through caching is performed\non a buffered file.  When setting up for write-through, we flush any\nconflicting writes in the region and wait for the write to complete,\nfailing if there's a write error to return.\n\nThe issue arises if we're writing at or above the EOF position because we\nskip the flush and - more importantly - the wait.  This becomes a problem\nif there's a partial folio at the end of the file that is being written out\nand we want to make a write to it too.  Both the already-running write and\nthe write we start both want to clear the writeback mark, but whoever is\nsecond causes a warning looking something like:\n\n    ------------[ cut here ]------------\n    R=00000012: folio 11 is not under writeback\n    WARNING: CPU: 34 PID: 654 at fs/netfs/write_collect.c:105\n    ...\n    CPU: 34 PID: 654 Comm: kworker/u386:27 Tainted: G S ...\n    ...\n    Workqueue: events_unbound netfs_write_collection_worker\n    ...\n    RIP: 0010:netfs_writeback_lookup_folio\n\nFix this by making the flush-and-wait unconditional.  It will do nothing if\nthere are no folios in the pagecache and will return quickly if there are\nno folios in the region specified.\n\nFurther, move the WBC attachment above the flush call as the flush is going\nto attach a WBC and detach it again if it is not present - and since we\nneed one anyway we might as well share it."}],"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 vulnerability is triggered by local write(2)/pwritev2(2)/sync_file_range(2) syscalls against a file on a mounted 9p or AFS filesystem; no remote peer can initiate the sequence on its own.\nAC:L - The attacker controls both sides of the race — sync_file_range(SYNC_FILE_RANGE_WRITE) or an async io_uring/AIO RWF_SYNC write starts writeback without waiting and without holding i_rwsem, and an immediately following O_SYNC append at EOF lands in the same tail folio; the kernel test robot reproduced it in routine stress testing.\nPR:L - Any unprivileged local user with write access to a file on an existing 9p or AFS mount can trigger this — no capabilities are required, and 9p mounts writable by ordinary users are standard in VM guests and container runtimes (QEMU virtio-9p, WSL2, crosvm, Kata/gVisor).\nUI:N - The attacker performs every step itself on its own file; no action by another user or administrator is needed.\nS:U - The corruption and the vulnerable code are both in the kernel of the machine where the attack originates, so no security authority boundary is crossed.\nC:H - Premature PG_writeback clearing lets a folio be truncated, freed and reused while the reference-free ITER_XARRAY writethrough request is still transmitting from it, so freed-and-reused kernel memory is sent to the 9p/AFS server, and the resulting UAF is a general read primitive.\nI:H - The bug yields a use-after-free on page-cache folios plus a double kfree() of struct netfs_folio and a netfs_group refcount underflow in netfs_pages_written_back(), all of which are exploitable for heap corruption and arbitrary write, in addition to silent file data corruption.\nA:H - The second completion trips WARN() in netfs_pages_written_back() (panic under panic_on_warn) and VM_BUG_ON_FOLIO() inside folio_end_writeback() under CONFIG_DEBUG_VM, and the underlying use-after-free crashes the kernel outright."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/netfs/buffered_write.c"],"versions":[{"version":"41d8e7673a7726cba57cb8112d81c89cfb6c3e35","lessThan":"5eaf23b2e81349f6614f88396dc468fda89fc0b9","status":"affected","versionType":"git"},{"version":"41d8e7673a7726cba57cb8112d81c89cfb6c3e35","lessThan":"c97f59e276d4e93480f29a70accbd0d7273cf3f5","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/netfs/buffered_write.c"],"versions":[{"version":"6.8","status":"affected"},{"version":"0","lessThan":"6.8","status":"unaffected","versionType":"semver"},{"version":"6.8.9","lessThanOrEqual":"6.8.*","status":"unaffected","versionType":"semver"},{"version":"6.9","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.8.9"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.9"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/5eaf23b2e81349f6614f88396dc468fda89fc0b9"},{"url":"https://git.kernel.org/stable/c/c97f59e276d4e93480f29a70accbd0d7273cf3f5"}],"title":"netfs: Fix the pre-flush when appending to a file in writethrough mode","x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-36001","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-05-20T14:21:51.289020Z"}}}],"providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2024-06-04T17:48:03.177Z"}},{"providerMetadata":{"orgId":"af854a3a-2127-422b-91ae-364da2661108","shortName":"CVE","dateUpdated":"2024-08-02T03:30:11.620Z"},"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/5eaf23b2e81349f6614f88396dc468fda89fc0b9","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/c97f59e276d4e93480f29a70accbd0d7273cf3f5","tags":["x_transferred"]}]}]}}