{"id":"CVE-2026-98974","kind":"vulnerability","aliases":["CVE-2026-98974"],"related":[],"title":"Linux kernel XFS: exchange-range TO_EOF corrupts file sizes, letting shared blocks be rewritten","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfs: fix exchange-range-to-eof file size exchange\n\nNorbert Szetei posted a patch containing an incomplete description of a\nbug in XFS_IOC_EXCHANGE_RANGE's TO_EOF flag.  The bug tricks\nexchange-range into modifying a file so that it has shared blocks\nstarting beyond EOF, which is never allowed because files never have\nwritten data beyond EOF, and you can only share written data blocks.\nThis is key to all the incorrect behavior that follows.\n\nEventually I got from Norbert a description of what's going wrong:\n\n> Fair. Here it is with physical block numbers, 4k blocks. peer is the file\n> that gets rewritten and file1 is the one that ends up with the flag\n> cleared.\n>\n> Start, nothing shared:\n>\n>\tpeer size 4096   -> [100]\n>\tfile1 size 12288 -> [200] [201] [202]\n>\tdonor1 size 4096 -> [300]\n>\tdonor2 size 4096 -> [400]\n>\n> 1. FICLONERANGE peer's block into file1's middle slot:\n>\n>\tpeer size 4096   -> [100]\n>\tfile1 size 12288 -> [200] [100] [202] reflink flag set\n>                             ^^^^^ both files own block 100\n>\n> 2. XFS_IOC_EXCHANGE_RANGE file1 against donor1, file1_offset 0,\n> file2_offset 8192, length 0, TO_EOF. One block is exchanged, and the sizes\n> are exchanged with it:\n>\n>\tfile1 size 4096   -> [200] [100] [300] reflink flag set\n>                              ^^^^^^^^^^^ still owned, now past the size\n>\tdonor1 size 12288 -> [202]\n>\n> file1 says it is one block long while it still owns three. Nothing was\n> unmapped. file2_offset is block 2, so this exchange cannot clear a flag.\n>\n> 3. XFS_IOC_EXCHANGE_RANGE file1 against donor2, both offsets 0, length 4096.\n> By i_disk_size this is two one-block files exchanging everything, so\n> xmi_can_exchange_reflink_flags() agrees and the flag is cleared:\n>\n>\tfile1 size 4096   -> [400] [100] [300] reflink flag CLEARED\n>\tdonor2 size 4096  -> [200]\n>\n> Block 100 is still shared with peer.\n>\n> 4. pwrite(file1, 4096, 4096), which is file1's second slot, block 100.\n> xfs_is_cow_inode(file1) is false, so no CoW:\n>\n>\tpeer size 4096 -> [100] same block, new contents\n>\n> Block 100 is the only one that matters here. PoC below, it reads a file\n> called peer in the current directory. The filesystem needs reflink and\n> exchange-range, which mkfs.xfs 7.x turns on by default.\n\nSo yes, TO_EOF is screwing up the file size even if it's actually\nexchanging the data block correctly.  The following is the intended\nbehavior of XFS_EXCHANGE_RANGE_TO_EOF, as described by its manpage:\n\n\"Ignore the length parameter.  All bytes in file1_fd from file1_offset\n to EOF are moved to file2_fd, and file2's size is set to\n (file2_offset+(file1_length-file1_offset)).  Meanwhile, all bytes in\n file2 from file2_offset to EOF are moved to file1 and file1's size is\n set to (file1_offset+(file2_length-file2_offset)).\"\n\nIn other words, if we only exchange a portion of the file data, then we\nshould only exchange the portion of the file size that relates to the\nexchanged data.  Unfortunately, the code swaps the ondisk file size and\nthe incore file sizes, which is incorrect if the caller passes in a\nnonzero offset.\n\nHaving confused the file sizes, the PoC uses a second exchange-range\ncall on what looks like a non-reflinked single-block file.  Because the\nfile size is set incorrectly, exchange-range thinks it's exchanging the\nfull contents of two files and clears the reflink flag on the broken\nfile.  That enables an extending write of the broken file to rewrite the\nshared block that's just past EOF.  This has become known colloquially\nas refluxfs.\n\nOnce the file sizes are set correctly, the second exchange-range no\nlonger thinks that it's doing a full-contents swap, so it won't clear\nthe reflink flag on either of its file arguments.\n\nNorbert followed up to an earlier version of this patch with a second\ncomplaint about us not handling the i_disk_size state correctly:\n\n> The offsets are bounded against the incore i_size but subtracted from\n>\n---truncated---","summary":"The XFS filesystem's XFS_IOC_EXCHANGE_RANGE TO_EOF flag swaps whole on-disk and in-core file sizes instead of only the exchanged portion, leaving a file owning shared blocks past its EOF. A local user can then clear the reflink flag and rewrite a block shared with another file, modifying data they should not be able to change.","severity":"unknown","cvss":null,"epss":null,"exploited":false,"exploited_at":null,"products":[],"ecosystems":[],"tags":["kernel","linux","runtime","self-hosted","xfs"],"not_affected_if":["no-reflink","no-xfs"],"how_to_check":"- Check the kernel version with `uname -r` and compare it against the fixed kernel release in the NVD entry for CVE-2026-98974.\n- Confirm the XFS filesystems use reflink and exchange-range with `xfs_info /mountpoint` (look for `reflink=1`).","fix":"- Update the Linux kernel to a release that includes the upstream commit 'xfs: fix exchange-range-to-eof file size exchange'; the fixed version is unknown from the sources.\n- Reboot into the patched kernel; unknown whether a live patch exists.","status":"open","published_at":"2026-10-23T13:17:19+00:00","first_seen_at":"2026-10-23T21:57:33+00:00","triaged_at":"2026-10-25T04:56:23+00:00","updated_at":"2026-10-25T04:56:23+00:00","category":"runtime","confidence":0.6,"triage":{"at":"2026-10-25T04:56:23Z","model":"claude-haiku-5-5","output":{"fix":"- Update the Linux kernel to a release that includes the upstream commit 'xfs: fix exchange-range-to-eof file size exchange'; the fixed version is unknown from the sources.\n- Reboot into the patched kernel; unknown whether a live patch exists.","reach":"local","title":"Linux kernel XFS: exchange-range TO_EOF corrupts file sizes, letting shared blocks be rewritten","impact":"medium","summary":"The XFS filesystem's XFS_IOC_EXCHANGE_RANGE TO_EOF flag swaps whole on-disk and in-core file sizes instead of only the exchanged portion, leaving a file owning shared blocks past its EOF. A local user can then clear the reflink flag and rewrite a block shared with another file, modifying data they should not be able to change.","category":"runtime","nicknames":["refluxfs"],"who_cares":["linux","xfs","kernel","self-hosted"],"confidence":0.6,"needs_auth":"yes","worst_case":"local user rewrites data shared with another file","analyst_note":"Find the fixed kernel version and stable backport commits for CVE-2026-98974 from the NVD entry and kernel.org stable mailing list.","how_to_check":"- Check the kernel version with `uname -r` and compare it against the fixed kernel release in the NVD entry for CVE-2026-98974.\n- Confirm the XFS filesystems use reflink and exchange-range with `xfs_info /mountpoint` (look for `reflink=1`).","needs_analyst":true,"not_affected_if":["no-xfs","no-reflink"],"who_is_affected":"Systems running a Linux kernel with XFS mounted with reflink support, where local users can call the exchange-range ioctl on files. Hosts without XFS, or without reflink-enabled XFS volumes, are not exposed; the sources do not say whether default mkfs.xfs settings on 7.x make every new volume exposed.","user_interaction":"no","needs_special_setup":"yes","severity_if_unknown":"unknown"},"cost_usd":0.000835,"input_tokens":4807,"output_tokens":709,"severity_before":"unknown"},"analyst_status":null,"analyst_note":null,"search":"'-2026':18A,21A '-98974':19A,22A '0':284C,289C,359C '1':246C '100':231C,259C,264C,273C,307C,391C,401C,419C,433C,439C '12288':234C,262C,320C '2':274C,341C '200':235C,263C,306C,399C '201':236C '202':237C,265C,321C '3':349C '300':241C,308C,392C '4':407C '400':245C,390C '4096':230C,240C,244C,258C,305C,361C,389C,398C,410C,411C,432C '4k':204C '7':469C '8192':287C 'abl':91B 'actual':489C 'agre':381C 'allow':157C 'anoth':83B 'argument':745C 'becom':703C 'behavior':181C,500C 'beyond':152C,164C 'block':14A,64B,80B,150C,173C,202C,205C,250C,272C,293C,327C,340C,371C,400C,418C,435C,438C,493C,651C,695C 'bound':773C 'broken':680C,689C 'bug':125C,136C 'byte':517C,547C 'call':453C,640C 'caller':621C 'cannot':345C 'chang':93B 'clear':73B,224C,346C,386C,395C,674C,736C 'code':605C 'colloqui':705C 'complaint':759C 'confus':628C 'contain':119C 'content':437C,669C,730C 'core':50B 'correct':494C,714C,769C 'corrupt':9A 'cow':422C,429C 'current':457C 'cve':17A,20A 'data':86B,163C,172C,492C,585C,602C 'default':474C 'describ':508C 'descript':122C,190C 'directori':458C 'disk':46B,364C,766C 'donor1':238C,281C,318C 'donor2':242C,356C,396C 'earlier':751C 'either':741C 'enabl':683C 'end':219C 'eof':8A,40B,67B,110C,133C,153C,165C,291C,478C,506C,525C,554C,700C 'even':485C 'eventu':184C 'everyth':374C 'exchang':5A,37B,57B,107C,113C,129C,139C,277C,295C,300C,344C,352C,373C,378C,465C,490C,503C,579C,590C,601C,638C,661C,666C,718C 'exchange-rang':4A,138C,464C,637C,660C,717C 'exchange-range-to-eof':106C 'extend':685C 'fair':196C 'fals':426C 'fd':520C,530C 'ficlonerang':247C 'file':10A,51B,61B,84B,111C,144C,159C,209C,270C,372C,452C,483C,584C,595C,609C,614C,630C,652C,655C,672C,681C,690C,710C,744C 'file1':214C,232C,252C,260C,279C,282C,303C,322C,354C,387C,409C,414C,424C,519C,522C,540C,543C,558C,560C,566C 'file2':285C,337C,529C,532C,538C,549C,551C,568C,571C 'filesystem':33B,460C 'fix':105C 'flag':41B,76B,134C,223C,267C,310C,348C,380C,384C,394C,677C,739C 'follow':99C,183C,496C,747C 'full':668C,729C 'full-cont':728C 'get':211C 'go':194C 'got':186C 'handl':763C 'host':29B 'ignor':512C 'in-cor':48B 'incomplet':121C 'incor':613C,776C 'incorrect':180C,618C,659C 'inod':423C 'instead':53B 'intend':499C 'ioc':36B,128C,276C,351C 'kernel':2A,24B,97C 'key':176C 'known':704C 'leav':59B 'length':288C,360C,514C,542C,570C 'length-file1':541C 'length-file2':569C 'let':12A 'like':644C 'linux':1A,25B,96C 'local':69B 'long':328C 'longer':721C 'look':643C 'manpag':511C 'matter':445C 'meanwhil':545C 'middl':254C 'mkfs.xfs':468C 'modifi':85B,142C 'move':527C,556C 'need':461C 'never':156C,160C 'new':436C 'non':647C 'non-reflink':646C 'nonzero':625C 'norbert':114C,188C,746C 'noth':226C,334C 'number':203C 'offset':283C,286C,338C,358C,523C,539C,544C,552C,567C,572C,626C,771C 'on-disk':44B 'ondisk':608C 'one':217C,292C,326C,370C,443C 'one-block':369C 'own':62B,313C,332C 'paramet':515C 'pass':622C 'past':65B,315C,699C 'patch':118C,755C 'peer':206C,228C,248C,256C,406C,430C,454C 'physic':201C 'poc':447C,633C 'portion':58B,581C,592C 'post':116C 'pwrite':408C 'rang':6A,38B,108C,130C,140C,278C,353C,466C,504C,639C,662C,719C 'read':450C 'reflink':75B,266C,309C,379C,393C,462C,648C,676C,738C 'refluxf':707C 'refluxfs':23A 'relat':598C 'resolv':103C 'rewrit':78B,692C 'rewritten':16A,212C 'runtim':26B 'say':323C 'screw':480C 'second':416C,636C,716C,758C 'self':28B 'self-host':27B 'set':268C,311C,536C,564C,658C,713C 'share':13A,63B,81B,149C,170C,227C,404C,694C 'singl':650C 'single-block':649C 'size':11A,52B,112C,229C,233C,239C,243C,257C,261C,298C,304C,317C,319C,365C,388C,397C,431C,484C,534C,562C,596C,610C,615C,631C,656C,711C,767C,778C 'slot':255C,417C 'start':151C,225C 'state':768C 'still':312C,331C,403C 'subtract':780C 'swap':42B,606C,731C 'szetei':115C 'think':663C,722C 'three':333C 'trick':137C 'truncat':782C 'turn':471C 'two':368C,671C 'unfortun':603C 'unmap':336C 'us':761C 'use':634C 'user':70B 'version':752C 'vulner':100C 'whole':43B 'won':734C 'word':575C 'write':686C 'written':162C,171C 'wrong':195C 'x':470C 'xfs':3A,30B,32B,35B,104C,127C,275C,350C,420C,502C 'xmi':376C 'yes':476C","nicknames":["refluxfs"],"mitigations":[],"who_affected":"Systems running a Linux kernel with XFS mounted with reflink support, where local users can call the exchange-range ioctl on files. Hosts without XFS, or without reflink-enabled XFS volumes, are not exposed; the sources do not say whether default mkfs.xfs settings on 7.x make every new volume exposed.","tier":"A","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-23T13:17:19+00:00","kev":null,"cvss_vector":null,"cvss_by":null,"poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-98974","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-98974","severity":null,"published_at":"2026-10-23T13:17:19+00:00","modified_at":"2026-10-23T13:17:19+00:00","first_seen_at":"2026-10-23T21:57:33+00:00","fetched_at":"2026-10-23T22:29:03+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}