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
Unknown Object (File)
Jan 31 2025, 6:23 AM
Unknown Object (File)
Jan 27 2025, 8:17 PM
Unknown Object (File)
Jan 22 2025, 10:50 PM
Unknown Object (File)
Jan 18 2025, 3:31 AM
Unknown Object (File)
Jan 17 2025, 8:20 PM
Unknown Object (File)
Jan 13 2025, 7:23 PM
Unknown Object (File)
Jan 10 2025, 4:30 AM
Unknown Object (File)
Jan 7 2025, 10:52 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