Page MenuHomeFreeBSD

stand: Unbreak FAT32 in loader
ClosedPublic

Authored by grembo on Sep 7 2022, 5:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 23, 7:46 AM
Unknown Object (File)
Fri, Oct 31, 5:59 AM
Unknown Object (File)
Tue, Oct 28, 4:22 AM
Unknown Object (File)
Oct 25 2025, 6:29 AM
Unknown Object (File)
Oct 18 2025, 5:10 AM
Unknown Object (File)
Oct 12 2025, 7:00 AM
Unknown Object (File)
Oct 12 2025, 6:59 AM
Unknown Object (File)
Oct 12 2025, 6:59 AM
Subscribers

Details

Summary

This corrects an issue introduced in b4cb3fe0e39a3, where a freshly
allocated DOS_FS structure would not be initialized properly before
use in dos_open.

In case of FAT32 file systems, this would leave fs->dirents
uninitialized and - depending on its content and due to checks in
parsebs - prevent mounting the file system successfully.

This particularily impacted the EFI loader, as it was sometimes not
able to read files from a FAT32-formatted EFI partition, including
LoaderEnv (/efi/freebsd/loader.env).

Diff Detail

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

Event Timeline

grembo requested review of this revision.Sep 7 2022, 5:23 PM
grembo added inline comments.
stand/libsa/dosfs.c
605

FAT32 enters this block (so fs->dirents isn't initialized).

619

And - depending on circumstances - this check will fail.

Cool! Thanks for tracking this all the way down...

This revision is now accepted and ready to land.Sep 7 2022, 11:30 PM
This revision was automatically updated to reflect the committed changes.