Bug 276464 - fix assertion failure when running fsck_msdosfs -n
Summary: fix assertion failure when running fsck_msdosfs -n
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Konstantin Belousov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-19 18:30 UTC by John F. Carr
Modified: 2024-01-29 16:04 UTC (History)
1 user (show)

See Also:


Attachments
do not call checksize if the cluster is bad (472 bytes, patch)
2024-01-19 18:40 UTC, John F. Carr
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John F. Carr 2024-01-19 18:30:30 UTC
Running fsck_msdosfs -n on a bad filesystem produces the following output:

** /dev/zvol/fast/fat32s1
** Phase 1 - Read FAT and checking connectivity
FAT starts with odd byte sequence (f8ffff0ffffffff7)
Correct? no
** Phase 2 - Checking Directories
/archive/2013-02-02 Drum1 doesn't start a new cluster chain
Truncate? no
Assertion failed: (fat_is_cl_head(fat, head)), function checkchain, file /usr/home/jfc/freebsd/src/sbin/fsck_msdosfs/fat.c, line 1046.

The assertion may be invalid with -n.

Alternatively, this code from dir.c line 985

			} else {
				mod |= k = checksize(fat, p, &dirent);
				if (k & FSDIRMOD)
					mod |= THISMOD;
			}

should not execute if (mod & FSERROR).

This is the same bad filesystem from bug 276408.

# file -s /dev/zvol/fast/fat32
/dev/zvol/fast/fat32: DOS/MBR boot sector MS-MBR 9M english at offset 0x10+0xFF "Invalid partition table" at offset 0x127 "Error loading operating system" at offset 0x146 "Missing operating system", disk signature 0xaab3b4a1, created with driveID 0x81 at 21:59:0; partition 1 : ID=0xc, active, start-CHS (0x0,1,1), end-CHS (0x280,254,63), startsector 63, 586067202 sectors
# file -s /dev/zvol/fast/fat32s1 
/dev/zvol/fast/fat32s1: DOS/MBR boot sector, code offset 0x5a+2, OEM-ID "MSWIN4.1", sectors/cluster 64, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 63, sectors 586067202 (volumes > 32 MB), FAT (32 bit), sectors/FAT 71533, serial number 0x1dd91023, label: "SEA_DISK   "
Comment 1 John F. Carr 2024-01-19 18:40:38 UTC
Created attachment 247785 [details]
do not call checksize if the cluster is bad
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-01-20 23:21:59 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=deeb1d34024b3f843d965cdf204c745165c9bac0

commit deeb1d34024b3f843d965cdf204c745165c9bac0
Author:     John F. Carr <jfc@mit.edu>
AuthorDate: 2024-01-20 23:18:18 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-20 23:20:24 +0000

    fsck_msdosfs: do not call checksize() if the cluster is bad

    PR:     276464
    MFC after:      1 week

 sbin/fsck_msdosfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-01-27 09:12:51 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=63a7e799b32cd9a5dcc3158677330edf8ea313bb

commit 63a7e799b32cd9a5dcc3158677330edf8ea313bb
Author:     John F. Carr <jfc@mit.edu>
AuthorDate: 2024-01-20 23:18:18 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-27 09:11:31 +0000

    fsck_msdosfs: do not call checksize() if the cluster is bad

    PR:     276464

    (cherry picked from commit deeb1d34024b3f843d965cdf204c745165c9bac0)

 sbin/fsck_msdosfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-01-27 09:13:52 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ed143596029f4605354715c150381f2bbbc795f

commit 3ed143596029f4605354715c150381f2bbbc795f
Author:     John F. Carr <jfc@mit.edu>
AuthorDate: 2024-01-20 23:18:18 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-27 09:12:26 +0000

    fsck_msdosfs: do not call checksize() if the cluster is bad

    PR:     276464

    (cherry picked from commit deeb1d34024b3f843d965cdf204c745165c9bac0)

 sbin/fsck_msdosfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)