[Bug 262964] msdosfs: Implement BPB sanity check and replace the existing boot signature check

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 31 Mar 2022 21:31:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262964

            Bug ID: 262964
           Summary: msdosfs: Implement BPB sanity check and replace the
                    existing boot signature check
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: delphij@FreeBSD.org

Follow up of bug 262896 , recording in the ticket so it's not forgotten.

Currently we have inconsistent checks across different components, some insists
0xaa55 signature of boot sector, some are performing a subset of BPB sanity
checks, etc.

We should perform BPB sanity check for msdosfs related components.  Some of
preliminary ideas are found in https://reviews.freebsd.org/D34699 .  In summary
we would want to validate some simple items like:

 - Check if the beginning byte was an x86 JMP instruction (e9 xx xx / eb xx
90);
 - Bytes per sector has to be power of two and between 512 and 4096 (512, 1024,
2048 or 4096).
 - Sector per cluster has to be power of two and non-zero (1, 2, 4, 8, etc.)
 - Total sectors has to be non zero.
 - Reserved sectors has to be non zero.
 - must have at least one FAT

consistently across utilities and the kernel.

-- 
You are receiving this mail because:
You are the assignee for the bug.