{"api_version":"1","generated_at":"2026-09-11T21:38:11+00:00","cve":"CVE-2026-89772","urls":{"html":"https://cve.report/CVE-2026-89772","api":"https://cve.report/api/cve/CVE-2026-89772.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-89772","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-89772"},"summary":{"title":"btrfs: write-protect folios during data writeback","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: write-protect folios during data writeback\n\ncommit 095be159f3eb (\"btrfs: unify folio dirty flag clearing\") replaced\nthe folio_clear_dirty_for_io() call in extent_write_cache_pages() with a\nplain folio_test_dirty() check. Besides clearing the dirty flag,\nfolio_clear_dirty_for_io() also calls folio_mkclean(), which write-protects\nthe shared mmap PTEs mapping the folio. Note that we still do call\nfolio_clear_dirty_for_io() later in submit_one_sector() when we clear\ndirty on the last sector of the folio (the only sector for non-subpage\ncases). But we lost this early call in extent_write_cache_pages().\n\nWithout the extra write-protection, a process with the file mmap-ed can\nmodify a sector while it is being used by writeback in a way that\nexpects a stable folio (checksumming, compressing, copying, etc...)\nwithout faulting, which manifests as a handful of concrete bugs.\n\n1. For large folios or subpage sectorsize, it is possible to submit a bio\nwhich does not cover the whole folio. When this happens, we will have a\nbio in flight for a folio that we have *not* called\nfolio_clear_dirty_for_io() on. If a task with an existing mmap-ed PTE\nwrites (without faulting..) in this window, it can result in\ncorruptions. If the write arrives while the checksumming or writing itself\nis underway, this can result in an invalid checksum and later corruption\nreports on read. If the write arrives after checksumming/writing is done\nbut before the last sector dirty is cleared, then the write is present\nin page cache but doesn't affect the dirty tracking and will be lost\nwhen the folio is fully finished being submitted and the dirty bit\nis cleared. This results in losing the write even if fsync() is called.\n\n2. For zoned submissions which are done in batch separate from the main\nextent_writepage() loop, we also risk csum violations for those\nsubmissions. Zoned writes are clamped to max_zone_append_size and are\nnot aligned with folios, so a submission can span two folios. The first\nfolio being processed in extent_write_cache_pages() will call\nextent_write_locked_range() which will submit the partial range of the\nnext folio, while the rest of that folio could still be dirty. So\nclearing dirty on the submitted sectors doesn't call\nfolio_clear_dirty_for_io() and we have the same issue. Since\nextent_write_cache_pages() skips these batch submitted folios (they are\nalready marked for writeback from submission by the preceding folio), we\nmust add the extra write protection in lock_delalloc_folios().\n\n3. For inline extents this will subtly risk losing writes that happen\nafter/while we copy the inline extent but before we clear dirty on\nthe folio.\n\n4. For folios spanning EOF, mmap could tamper with the zeroed bytes past\nEOF and cause them to be persisted where future faults would improperly\nsee them instead of zeros.\n\n5. Finally, for compressed extents, we risk modifying the folios while we\nwork on compressing them which will result in corrupted compressed data.\nSpecifically, in run_delalloc_compressed() we queue up work to do\ncompress_file_range() in BTRFS_COMPRESSION_CHUNK_SIZE (512K) chunks which\nwill call btrfs_folio_clamp_clear_dirty() on the range. For non-subpage,\nthis will always clear the whole folio, safely. For subpage, we risk a\npartial clear here as well. In particular, imagine a 2M folio broken up\ninto 512K chunks of work which might start compression work on one chunk\nbefore all the chunks compress_file_range() workers have gotten far\nenough to finish clearing all the dirty bitmaps of the folio and getting\nto folio_clear_dirty_for_io(). Large folios on the edges of submission\nranges are similarly at risk to be only partly cleared.\nThis particular gap was introduced by a second patch in the same series:\ncommit a4ef54dbb576 (\"btrfs: make extent_range_clear_dirty_for_io() to handle sector size < page size cases\")\n\nWe cannot simply restore the call to folio_clear\n---truncated---","state":"PUBLISHED","assigner":"Linux","published_at":"2026-09-11 20:20:08","updated_at":"2026-09-11 20:20:08"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/074c715e0b498891c09fe7f11e1cd9d7a04699bd","name":"https://git.kernel.org/stable/c/074c715e0b498891c09fe7f11e1cd9d7a04699bd","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/5376c9db45368eb210b4d71104ac00a59dc8b6e0","name":"https://git.kernel.org/stable/c/5376c9db45368eb210b4d71104ac00a59dc8b6e0","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-89772","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-89772","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected a4ef54dbb576032ba31a646a5ffc8a26a83cb92c 074c715e0b498891c09fe7f11e1cd9d7a04699bd git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected a4ef54dbb576032ba31a646a5ffc8a26a83cb92c 5376c9db45368eb210b4d71104ac00a59dc8b6e0 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 6.13","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.13 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.2.4 7.2.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["fs/btrfs/extent_io.c","fs/btrfs/extent_io.h","fs/btrfs/inode.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"074c715e0b498891c09fe7f11e1cd9d7a04699bd","status":"affected","version":"a4ef54dbb576032ba31a646a5ffc8a26a83cb92c","versionType":"git"},{"lessThan":"5376c9db45368eb210b4d71104ac00a59dc8b6e0","status":"affected","version":"a4ef54dbb576032ba31a646a5ffc8a26a83cb92c","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["fs/btrfs/extent_io.c","fs/btrfs/extent_io.h","fs/btrfs/inode.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"6.13"},{"lessThan":"6.13","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"7.2.*","status":"unaffected","version":"7.2.4","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.3-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.2.4","versionStartIncluding":"6.13","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3-rc1","versionStartIncluding":"6.13","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: write-protect folios during data writeback\n\ncommit 095be159f3eb (\"btrfs: unify folio dirty flag clearing\") replaced\nthe folio_clear_dirty_for_io() call in extent_write_cache_pages() with a\nplain folio_test_dirty() check. Besides clearing the dirty flag,\nfolio_clear_dirty_for_io() also calls folio_mkclean(), which write-protects\nthe shared mmap PTEs mapping the folio. Note that we still do call\nfolio_clear_dirty_for_io() later in submit_one_sector() when we clear\ndirty on the last sector of the folio (the only sector for non-subpage\ncases). But we lost this early call in extent_write_cache_pages().\n\nWithout the extra write-protection, a process with the file mmap-ed can\nmodify a sector while it is being used by writeback in a way that\nexpects a stable folio (checksumming, compressing, copying, etc...)\nwithout faulting, which manifests as a handful of concrete bugs.\n\n1. For large folios or subpage sectorsize, it is possible to submit a bio\nwhich does not cover the whole folio. When this happens, we will have a\nbio in flight for a folio that we have *not* called\nfolio_clear_dirty_for_io() on. If a task with an existing mmap-ed PTE\nwrites (without faulting..) in this window, it can result in\ncorruptions. If the write arrives while the checksumming or writing itself\nis underway, this can result in an invalid checksum and later corruption\nreports on read. If the write arrives after checksumming/writing is done\nbut before the last sector dirty is cleared, then the write is present\nin page cache but doesn't affect the dirty tracking and will be lost\nwhen the folio is fully finished being submitted and the dirty bit\nis cleared. This results in losing the write even if fsync() is called.\n\n2. For zoned submissions which are done in batch separate from the main\nextent_writepage() loop, we also risk csum violations for those\nsubmissions. Zoned writes are clamped to max_zone_append_size and are\nnot aligned with folios, so a submission can span two folios. The first\nfolio being processed in extent_write_cache_pages() will call\nextent_write_locked_range() which will submit the partial range of the\nnext folio, while the rest of that folio could still be dirty. So\nclearing dirty on the submitted sectors doesn't call\nfolio_clear_dirty_for_io() and we have the same issue. Since\nextent_write_cache_pages() skips these batch submitted folios (they are\nalready marked for writeback from submission by the preceding folio), we\nmust add the extra write protection in lock_delalloc_folios().\n\n3. For inline extents this will subtly risk losing writes that happen\nafter/while we copy the inline extent but before we clear dirty on\nthe folio.\n\n4. For folios spanning EOF, mmap could tamper with the zeroed bytes past\nEOF and cause them to be persisted where future faults would improperly\nsee them instead of zeros.\n\n5. Finally, for compressed extents, we risk modifying the folios while we\nwork on compressing them which will result in corrupted compressed data.\nSpecifically, in run_delalloc_compressed() we queue up work to do\ncompress_file_range() in BTRFS_COMPRESSION_CHUNK_SIZE (512K) chunks which\nwill call btrfs_folio_clamp_clear_dirty() on the range. For non-subpage,\nthis will always clear the whole folio, safely. For subpage, we risk a\npartial clear here as well. In particular, imagine a 2M folio broken up\ninto 512K chunks of work which might start compression work on one chunk\nbefore all the chunks compress_file_range() workers have gotten far\nenough to finish clearing all the dirty bitmaps of the folio and getting\nto folio_clear_dirty_for_io(). Large folios on the edges of submission\nranges are similarly at risk to be only partly cleared.\nThis particular gap was introduced by a second patch in the same series:\ncommit a4ef54dbb576 (\"btrfs: make extent_range_clear_dirty_for_io() to handle sector size < page size cases\")\n\nWe cannot simply restore the call to folio_clear\n---truncated---"}],"providerMetadata":{"dateUpdated":"2026-09-11T19:47:11.125Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/074c715e0b498891c09fe7f11e1cd9d7a04699bd"},{"url":"https://git.kernel.org/stable/c/5376c9db45368eb210b4d71104ac00a59dc8b6e0"}],"title":"btrfs: write-protect folios during data writeback","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-89772","datePublished":"2026-09-11T19:47:11.125Z","dateReserved":"2026-09-11T19:38:34.765Z","dateUpdated":"2026-09-11T19:47:11.125Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-09-11 20:20:08","lastModifiedDate":"2026-09-11 20:20:08","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"89772","Ordinal":"1","Title":"btrfs: write-protect folios during data writeback","CVE":"CVE-2026-89772","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"89772","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: write-protect folios during data writeback\n\ncommit 095be159f3eb (\"btrfs: unify folio dirty flag clearing\") replaced\nthe folio_clear_dirty_for_io() call in extent_write_cache_pages() with a\nplain folio_test_dirty() check. Besides clearing the dirty flag,\nfolio_clear_dirty_for_io() also calls folio_mkclean(), which write-protects\nthe shared mmap PTEs mapping the folio. Note that we still do call\nfolio_clear_dirty_for_io() later in submit_one_sector() when we clear\ndirty on the last sector of the folio (the only sector for non-subpage\ncases). But we lost this early call in extent_write_cache_pages().\n\nWithout the extra write-protection, a process with the file mmap-ed can\nmodify a sector while it is being used by writeback in a way that\nexpects a stable folio (checksumming, compressing, copying, etc...)\nwithout faulting, which manifests as a handful of concrete bugs.\n\n1. For large folios or subpage sectorsize, it is possible to submit a bio\nwhich does not cover the whole folio. When this happens, we will have a\nbio in flight for a folio that we have *not* called\nfolio_clear_dirty_for_io() on. If a task with an existing mmap-ed PTE\nwrites (without faulting..) in this window, it can result in\ncorruptions. If the write arrives while the checksumming or writing itself\nis underway, this can result in an invalid checksum and later corruption\nreports on read. If the write arrives after checksumming/writing is done\nbut before the last sector dirty is cleared, then the write is present\nin page cache but doesn't affect the dirty tracking and will be lost\nwhen the folio is fully finished being submitted and the dirty bit\nis cleared. This results in losing the write even if fsync() is called.\n\n2. For zoned submissions which are done in batch separate from the main\nextent_writepage() loop, we also risk csum violations for those\nsubmissions. Zoned writes are clamped to max_zone_append_size and are\nnot aligned with folios, so a submission can span two folios. The first\nfolio being processed in extent_write_cache_pages() will call\nextent_write_locked_range() which will submit the partial range of the\nnext folio, while the rest of that folio could still be dirty. So\nclearing dirty on the submitted sectors doesn't call\nfolio_clear_dirty_for_io() and we have the same issue. Since\nextent_write_cache_pages() skips these batch submitted folios (they are\nalready marked for writeback from submission by the preceding folio), we\nmust add the extra write protection in lock_delalloc_folios().\n\n3. For inline extents this will subtly risk losing writes that happen\nafter/while we copy the inline extent but before we clear dirty on\nthe folio.\n\n4. For folios spanning EOF, mmap could tamper with the zeroed bytes past\nEOF and cause them to be persisted where future faults would improperly\nsee them instead of zeros.\n\n5. Finally, for compressed extents, we risk modifying the folios while we\nwork on compressing them which will result in corrupted compressed data.\nSpecifically, in run_delalloc_compressed() we queue up work to do\ncompress_file_range() in BTRFS_COMPRESSION_CHUNK_SIZE (512K) chunks which\nwill call btrfs_folio_clamp_clear_dirty() on the range. For non-subpage,\nthis will always clear the whole folio, safely. For subpage, we risk a\npartial clear here as well. In particular, imagine a 2M folio broken up\ninto 512K chunks of work which might start compression work on one chunk\nbefore all the chunks compress_file_range() workers have gotten far\nenough to finish clearing all the dirty bitmaps of the folio and getting\nto folio_clear_dirty_for_io(). Large folios on the edges of submission\nranges are similarly at risk to be only partly cleared.\nThis particular gap was introduced by a second patch in the same series:\ncommit a4ef54dbb576 (\"btrfs: make extent_range_clear_dirty_for_io() to handle sector size < page size cases\")\n\nWe cannot simply restore the call to folio_clear\n---truncated---","Type":"Description","Title":"btrfs: write-protect folios during data writeback"}]}}}