Page MenuHomeFreeBSD

ffs_reallocblks(): ensure that pref cg is valid
ClosedPublic

Authored by kib on Jan 7 2025, 9:42 PM.
Tags
None
Referenced Files
F157996411: D48378.id.diff
Wed, May 27, 7:39 AM
Unknown Object (File)
Wed, May 27, 12:06 AM
Unknown Object (File)
Tue, May 26, 11:42 PM
Unknown Object (File)
Mon, May 25, 11:26 AM
Unknown Object (File)
Sat, May 23, 5:31 PM
Unknown Object (File)
Sun, May 17, 10:50 PM
Unknown Object (File)
Sun, May 17, 10:49 PM
Unknown Object (File)
Sun, May 17, 10:49 PM
Subscribers

Details

Summary
ffs_blkpref_ufsX() must return in-range pref frag number, otherwise
calculated cg index is out of range for fs, causing out of range
accesses to the structures sized by the number of cg, e.g. the
fs_maxcluster[] array in ffs_clusteralloc().

The easiest way to trigger it is to overflow the volume.

ffs_blkpref_ufsX(): do not iterate over startcg twice

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jan 7 2025, 9:42 PM

These changes look correct to me. I am surprised that it has taken this long to trip over this error case.

This revision is now accepted and ready to land.Jan 13 2025, 5:04 AM