Skip to content

exfat: add volume limit bounds checks#1320

Open
vfsci-bot[bot] wants to merge 3 commits intovfs.base.cifrom
pw/1089881/vfs.base.ci
Open

exfat: add volume limit bounds checks#1320
vfsci-bot[bot] wants to merge 3 commits intovfs.base.cifrom
pw/1089881/vfs.base.ci

Conversation

@vfsci-bot
Copy link
Copy Markdown

@vfsci-bot vfsci-bot Bot commented May 5, 2026

Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1089881
Submitter: David Timber
Version: 1
Patches: 3/3
Message-ID: <[email protected]>
Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/[email protected]


Automated by ml2pr

dxdxdt added 3 commits May 5, 2026 15:53
If the user inadvertenly truncates an exFAT volume(mistakenly shrinks
the partition or simply dd'ing from a larger removable device to a
smaller one. eg: device marketed as having 8GB capatity < 8GiB), the
kernel exFAT obliviously mounts the volume and operates on it. No error
is reported to userspace unless the filesystem is accessed with O_SYNC
or O_DIRECT.

Off by one sector test:

	# truncate -s 1073741824 img
	# mkfs.exfat img
	# truncate -s 1073741312 img
	# mount -t exfat img ...

The existing filesystem implementations, prime examples being XFS and
ext*, refuse to mount the volume with such condition. Introduce the
checks similar checks in-place to exFAT.

Also, to prevent UB, add checks against exFAT volumes with maliciously
a crafted main boot sectors with the ClusterCount field equal to or
larger than (2^32 - 11) as per format spec.

Link: exfatprogs/exfatprogs#353
Signed-off-by: David Timber <[email protected]>
If the block size specified in the exFAT volume boot sector is different
from the actual logical block size of the device, many implementations
including FUSE-exfat, macos and previous versions of Windows are not
able to mount the volume.

A possible scenario in which this can happen is when the user dd's the
volume in a 4K-blocksize device("Advanced Format") to a 512-blocksize
device. This is a design issue inherent to the exFAT format itself
which layouts the structures of exFAT volumes aligned to the sector
size rather than large byte sizes as seen with other modern file
systems.

Print a kind warning about this potential compatibility issue.

Link: exfatprogs/exfatprogs#349
Signed-off-by: David Timber <[email protected]>
Fix memory leak conditions due to exfat_free_upcase_table() not being
called.

Signed-off-by: David Timber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant