Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FatPkg: Validate Reserved FAT Entries on Volume Open #10609

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

os-d
Copy link
Contributor

@os-d os-d commented Jan 10, 2025

Description

There are two reserved FAT entries in the FAT filesystem that are expected to have valid contents in them. Today the FAT drivers do not validate these entries when reading from a device for the first time. This can cause infinite loops in the FAT driver when trying to read corrupted disks as reported in
#9679.

This PR follows the recommended update requested in that bug to check the two reserved FAT entries and validate their contents against the spec defined values in both FatPei and EnhancedFatDxe when opening a device for the first time.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Tested on OVMF, EmulatorPkg, and ArmVirtPkg and confirmed that correctly formatted devices are able to boot.

Integration Instructions

N/A.

@os-d
Copy link
Contributor Author

os-d commented Jan 10, 2025

@mdkinney @leiflindholm @ajfish as I am the only maintainer of FatPkg, can a steward please help review this PR?

FatPkg/EnhancedFatDxe/Init.c Outdated Show resolved Hide resolved
FatPkg/EnhancedFatDxe/Init.c Outdated Show resolved Hide resolved
There are two reserved FAT entries in the FAT filesystem that
are expected to have valid contents in them. Today the FAT drivers
do not validate these entries when reading from a device for the
first time. This can cause infinite loops in the FAT driver when
trying to read corrupted disks as reported in
tianocore#9679.

This PR follows the recommended update requested in that bug to
check the two reserved FAT entries and validate their contents
against the spec defined values in both FatPei and EnhancedFatDxe
when opening a device for the first time.

Signed-off-by: Oliver Smith-Denny <[email protected]>
@os-d
Copy link
Contributor Author

os-d commented Jan 17, 2025

@mdkinney @leiflindholm @ajfish , I have missed the CI failure, can you help review?

@mdkinney
Copy link
Member

I see all checks have passed

@os-d
Copy link
Contributor Author

os-d commented Jan 17, 2025

I see all checks have passed

@mdkinney , oops, typo! I meant to say I have fixed the CI failure. I am the only FatPkg maintainer, so would like a steward review to merge this.

@os-d os-d added the push Auto push patch series in PR if all checks pass label Jan 17, 2025
Copy link

mergify bot commented Jan 17, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@os-d
Copy link
Contributor Author

os-d commented Jan 17, 2025

@Mergifyio requeue

Copy link

mergify bot commented Jan 17, 2025

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

@os-d
Copy link
Contributor Author

os-d commented Jan 17, 2025

This hit an issue with EmulatorPkg that commonly comes up, not being able to allocate the PeiServiceTablePointer. Requeued as it should pass next time.

@mdkinney
Copy link
Member

We seem to be hitting this condition more frequently now. Either need to find a better address value or change the EmulatorPkg design to not depend on a specific address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
3 participants