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

NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol #6202

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

mikebeaton
Copy link
Contributor

@mikebeaton mikebeaton commented Sep 13, 2024

Description

The existing HttpBootUninstallCallback was passing the wrong handle (the PrivateData root controller handle, not the correct child IPv4 or IPv6 NIC controller handle; cf HttpBootInstallCallback above in the file for matching logic) and was also passing the address of a pointer to the interface to be removed rather than the pointer itself, so always failed with EFI_NOT_FOUND.

This resulted in the prior behaviour that if multiple HTTP boot attempts were made, on the second and subsequent attempts the instance of this protocol installed by the first attempt would be re-used. As long as only one driver using the protocol is installed, this ends up producing the same results as if the protocol had been uninstalled then reinstalled correctly.

After this commit, the protocol is installed at the start of an HTTP boot attempt and uninstalled it at the end of it (assuming nothing else has accessed the protocol in a way which blocks the uninstall).

It might seem attractive to add an ASSERT to confirm when debugging that the uninstall succeeds as expected, but this is recommended against because uninstallation of protocol interfaces is allowed to fail under the UEFI model:
https://edk2.groups.io/g/devel/message/117469. An ASSERT could therefore arise from a sequence of events which is perfectly valid - or at least is out of the control of this driver.

  • Breaking change?
  • Impacts security?
    • Security - No known security impact of prior behaviour, or proposed fix.
  • Includes tests?

How This Was Tested

Single step debugging to verify previous behaviour and corrected new behaviour.

Integration Instructions

N/A

The existing HttpBootUninstallCallback was passing the wrong handle (the
PrivateData root controller handle, not the correct child IPv4 or IPv6
NIC controller handle; cf HttpBootInstallCallback for matching logic) and
was also passing the address of a pointer to the interface to be removed
rather than the pointer itself, so always failed with EFI_NOT_FOUND.

This resulted in the prior behaviour that if multiple HTTP boot attempts
were made, on the second and subsequent attempts the instance of this
protocol installed by the first attempt would be re-used. As long as only
one driver using the protocol is installed, this ends up producing the
same results as if the protocol had been uninstalled then reinstalled
correctly.

After this commit, the protocol is installed at the start of an HTTP boot
attempt and uninstalled it at the end of it (assuming nothing else has
accessed the protocol in a way which blocks the uninstall).

It might seem attractive to add an ASSERT to confirm when debugging
that the uninstall succeeds as expected, but this is recommended against
because uninstallation of protocol interfaces is allowed to fail under
the UEFI model:
https://edk2.groups.io/g/devel/message/117469.
An ASSERT could therefore arise from a sequence of events which is
perfectly valid - or at least is out of the control of this driver.

Signed-off-by: Mike Beaton <[email protected]>
@mikebeaton
Copy link
Contributor Author

I have added a bugzilla report for this issue https://bugzilla.tianocore.org/show_bug.cgi?id=4852.

@mdkinney mdkinney added the push Auto push patch series in PR if all checks pass label Sep 15, 2024
@mergify mergify bot merged commit 73dbb68 into tianocore:master Sep 15, 2024
126 checks passed
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
Development

Successfully merging this pull request may close these issues.

3 participants