Skip to content

Commit

Permalink
fs/fat: don't error when mtime is 0
Browse files Browse the repository at this point in the history
In the wild, we occasionally see valid ESPs where some file modification times
are 0.  For instance:

    ├── [Dec 31  1979]  EFI
    │   ├── [Dec 31  1979]  BOOT
    │   │   ├── [Dec 31  1979]  BOOTX64.EFI
    │   │   └── [Dec 31  1979]  fbx64.efi
    │   └── [Jun 27 02:41]  fedora
    │       ├── [Dec 31  1979]  BOOTX64.CSV
    │       ├── [Dec 31  1979]  fonts
    │       ├── [Mar 14 03:35]  fw
    │       │   ├── [Mar 14 03:35]  fwupd-359c1169-abd6-4a0d-8bce-e4d4713335c1.cap
    │       │   ├── [Mar 14 03:34]  fwupd-9d255c4b-2d88-4861-860d-7ee52ade9463.cap
    │       │   └── [Mar 14 03:34]  fwupd-b36438d8-9128-49d2-b280-487be02d948b.cap
    │       ├── [Dec 31  1979]  fwupdx64.efi
    │       ├── [May 10 10:47]  grub.cfg
    │       ├── [Jun  3 12:38]  grub.cfg.new.new
    │       ├── [May 10 10:41]  grub.cfg.old
    │       ├── [Jun 27 02:41]  grubenv
    │       ├── [Dec 31  1979]  grubx64.efi
    │       ├── [Dec 31  1979]  mmx64.efi
    │       ├── [Dec 31  1979]  shim.efi
    │       ├── [Dec 31  1979]  shimx64.efi
    │       └── [Dec 31  1979]  shimx64-fedora.efi
    └── [Dec 31  1979]  FSCK0000.REC

    5 directories, 17 files

This causes grub-probe failure, which in turn causes grub-mkconfig
failure.  They are valid filesystems that appear intact, and the Linux
FAT stack is able to mount and manipulate them without complaint.

The check for mtime of 0 has been present since
20def1a ("fat: support file
modification times").

Signed-off-by: Robbie Harwood <[email protected]>
(cherry picked from commit 0615c4887352e32d7bb7198e9ad0d695f9dc2c31)
  • Loading branch information
frozencemetery committed Jul 19, 2022
1 parent 8436d90 commit 0298109
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions grub-core/fs/fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,9 +1027,6 @@ grub_fat_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook,
grub_le_to_cpu16 (ctxt.dir.w_date),
&info.mtime);
#endif
if (info.mtimeset == 0)
grub_error (GRUB_ERR_OUT_OF_RANGE,
"invalid modification timestamp for %s", path);

if (hook (ctxt.filename, &info, hook_data))
break;
Expand Down

0 comments on commit 0298109

Please sign in to comment.