# CVE-2026-98974: xfs: fix exchange-range-to-eof file size exchange

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 4, 2026-11-26)
- **Published:** 2026-10-23T12:19:47.424Z
- **Modified:** 2026-10-24T14:16:49.923Z

## Who should check

- Anyone running Linux \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< b361d32b884f8ddcb9bad5d99b69eece648f8e43; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< cf32eb20dfacfd2e92ce86ba1fece9ae5f98a7d8; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< 952b5c99a840c2bff1f6645fd5e06e1db6ec2623; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9
- Anyone running Linux 6.10

## Description

In the Linux kernel, the following vulnerability has been resolved:

xfs: fix exchange-range-to-eof file size exchange

Norbert Szetei posted a patch containing an incomplete description of a
bug in XFS\_IOC\_EXCHANGE\_RANGE's TO\_EOF flag.  The bug tricks
exchange-range into modifying a file so that it has shared blocks
starting beyond EOF, which is never allowed because files never have
written data beyond EOF, and you can only share written data blocks.
This is key to all the incorrect behavior that follows.

Eventually I got from Norbert a description of what's going wrong:

\> Fair. Here it is with physical block numbers, 4k blocks. peer is the file
\> that gets rewritten and file1 is the one that ends up with the flag
\> cleared.
\>
\> Start, nothing shared:
\>
\>	peer size 4096   -\> \[100\]
\>	file1 size 12288 -\> \[200\] \[201\] \[202\]
\>	donor1 size 4096 -\> \[300\]
\>	donor2 size 4096 -\> \[400\]
\>
\> 1. FICLONERANGE peer's block into file1's middle slot:
\>
\>	peer size 4096   -\> \[100\]
\>	file1 size 12288 -\> \[200\] \[100\] \[202\] reflink flag set
\>                             ^^^^^ both files own block 100
\>
\> 2. XFS\_IOC\_EXCHANGE\_RANGE file1 against donor1, file1\_offset 0,
\> file2\_offset 8192, length 0, TO\_EOF. One block is exchanged, and the sizes
\> are exchanged with it:
\>
\>	file1 size 4096   -\> \[200\] \[100\] \[300\] reflink flag set
\>                              ^^^^^^^^^^^ still owned, now past the size
\>	donor1 size 12288 -\> \[202\]
\>
\> file1 says it is one block long while it still owns three. Nothing was
\> unmapped. file2\_offset is block 2, so this exchange cannot clear a flag.
\>
\> 3. XFS\_IOC\_EXCHANGE\_RANGE file1 against donor2, both offsets 0, length 4096.
\> By i\_disk\_size this is two one-block files exchanging everything, so
\> xmi\_can\_exchange\_reflink\_flags() agrees and the flag is cleared:
\>
\>	file1 size 4096   -\> \[400\] \[100\] \[300\] reflink flag CLEARED
\>	donor2 size 4096  -\> \[200\]
\>
\> Block 100 is still shared with peer.
\>
\> 4. pwrite(file1, 4096, 4096), which is file1's second slot, block 100.
\> xfs\_is\_cow\_inode(file1) is false, so no CoW:
\>
\>	peer size 4096 -\> \[100\] same block, new contents
\>
\> Block 100 is the only one that matters here. PoC below, it reads a file
\> called peer in the current directory. The filesystem needs reflink and
\> exchange-range, which mkfs.xfs 7.x turns on by default.

So yes, TO\_EOF is screwing up the file size even if it's actually
exchanging the data block correctly.  The following is the intended
behavior of XFS\_EXCHANGE\_RANGE\_TO\_EOF, as described by its manpage:

"Ignore the length parameter.  All bytes in file1\_fd from file1\_offset
 to EOF are moved to file2\_fd, and file2's size is set to
 (file2\_offset+(file1\_length-file1\_offset)).  Meanwhile, all bytes in
 file2 from file2\_offset to EOF are moved to file1 and file1's size is
 set to (file1\_offset+(file2\_length-file2\_offset))."

In other words, if we only exchange a portion of the file data, then we
should only exchange the portion of the file size that relates to the
exchanged data.  Unfortunately, the code swaps the ondisk file size and
the incore file sizes, which is incorrect if the caller passes in a
nonzero offset.

Having confused the file sizes, the PoC uses a second exchange-range
call on what looks like a non-reflinked single-block file.  Because the
file size is set incorrectly, exchange-range thinks it's exchanging the
full contents of two files and clears the reflink flag on the broken
file.  That enables an extending write of the broken file to rewrite the
shared block that's just past EOF.  This has become known colloquially
as refluxfs.

Once the file sizes are set correctly, the second exchange-range no
longer thinks that it's doing a full-contents swap, so it won't clear
the reflink flag on either of its file arguments.

Norbert followed up to an earlier version of this patch with a second
complaint about us not handling the i\_disk\_size state correctly:

\> The offsets are bounded against the incore i\_size but subtracted from
\>
---truncated---

## Affected and fixed versions

- Linux: \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< b361d32b884f8ddcb9bad5d99b69eece648f8e43; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< cf32eb20dfacfd2e92ce86ba1fece9ae5f98a7d8; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< 952b5c99a840c2bff1f6645fd5e06e1db6ec2623; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9 (cvelist)
- Linux: 6.10 (cvelist)

## Mitigation

- Upgrade Linux to 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-98974. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-98974.md
Affected: Linux >= 966ceafc7a437105ecfe1cadb3747b2965a260ca, < b361d32b884f8ddcb9bad5d99b69eece648f8e43; >= 966ceafc7a437105ecfe1cadb3747b2965a260ca, < cf32eb20dfacfd2e92ce86ba1fece9ae5f98a7d8; >= 966ceafc7a437105ecfe1cadb3747b2965a260ca, < 952b5c99a840c2bff1f6645fd5e06e1db6ec2623; >= 966ceafc7a437105ecfe1ca…
Fixed in: Linux 952b5c99a840c2bff1f6645fd5e06e1db6ec2623, Linux 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-98974 being exploited?

There is no confirmed exploitation: CVE-2026-98974 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.18% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2026-98974?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-98974?

Linux \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< b361d32b884f8ddcb9bad5d99b69eece648f8e43; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< cf32eb20dfacfd2e92ce86ba1fece9ae5f98a7d8; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< 952b5c99a840c2bff1f6645fd5e06e1db6ec2623; \>= 966ceafc7a437105ecfe1cadb3747b2965a260ca, \< 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9; Linux 6.10.

### Is there a fix for CVE-2026-98974?

Yes. Fixed in Linux 952b5c99a840c2bff1f6645fd5e06e1db6ec2623, Linux 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9. Upgrade Linux to 7dfb218c829c1acb626e0fe92c5fddb9a26a03e9 or later.

### How do I check if I'm affected by CVE-2026-98974?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/b361d32b884f8ddcb9bad5d99b69eece648f8e43>
- other: <https://git.kernel.org/stable/c/cf32eb20dfacfd2e92ce86ba1fece9ae5f98a7d8>
- other: <https://git.kernel.org/stable/c/952b5c99a840c2bff1f6645fd5e06e1db6ec2623>
- other: <https://git.kernel.org/stable/c/7dfb218c829c1acb626e0fe92c5fddb9a26a03e9>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-98974>

HTML: <https://flawdb.com/CVE-2026-98974> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-98974>
