From 5443e70b9d20a970900b70284704a0ac151465f5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 9 Nov 2018 21:13:58 +0100 Subject: [PATCH] Fix network boot via grub (bz 1648476) --- ...xeBcDxe-Add-EXCLUSIVE-attribute-when.patch | 73 +++++++++++++++++++ edk2.spec | 7 +- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 0023-NetworkPkg-UefiPxeBcDxe-Add-EXCLUSIVE-attribute-when.patch diff --git a/0023-NetworkPkg-UefiPxeBcDxe-Add-EXCLUSIVE-attribute-when.patch b/0023-NetworkPkg-UefiPxeBcDxe-Add-EXCLUSIVE-attribute-when.patch new file mode 100644 index 0000000..6487983 --- /dev/null +++ b/0023-NetworkPkg-UefiPxeBcDxe-Add-EXCLUSIVE-attribute-when.patch @@ -0,0 +1,73 @@ +From cde5a72d365eff5b02b8330fef1c8d36fced08eb Mon Sep 17 00:00:00 2001 +From: "edk2-devel-bounces@lists.01.org" +Date: Fri, 14 Sep 2018 16:24:15 +0800 +Subject: [PATCH] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when + opening SNP protocol installed by PXE. + +Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152 + +v2: Sync the same logic to Ipv6 and update code comments. + +The PXE driver installs a SNP and open this SNP with attribute BY_DRIVER +to avoid it being opened by MNP driver, this SNP is also expected not to +be opened by other drivers with EXCLUSIVE attribute. In some cases, other +drivers may happen to do this by error, and thus cause a system crash. +This patch adds EXCLUSIVE attribute when opening SNP in PXE driver, and +will reject all OpenProtocol requests by EXCLUSIVE. + +Cc: Subramanian, Sriram +Cc: Ye Ting +Cc: Fu Siyuan +Cc: Wu Jiaxin +Contributed-under: TianoCore Contribution Agreement 1.1 +Signed-off-by: Wang Fan +Reviewed-by: Sriram Subramanian +Reviewed-by: Fu Siyuan +Reviewed-by: Wu Jiaxin +--- + NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +index bc9dc914f3..0ab640beca 100644 +--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c ++++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +@@ -814,7 +814,7 @@ PxeBcCreateIp4Children ( + } + + // +- // Open SNP on the child handle BY_DRIVER. It will prevent any additionally ++ // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally + // layering to perform the experiment. + // + Status = gBS->OpenProtocol ( +@@ -823,7 +823,7 @@ PxeBcCreateIp4Children ( + (VOID **) &Snp, + This->DriverBindingHandle, + Private->Ip4Nic->Controller, +- EFI_OPEN_PROTOCOL_BY_DRIVER ++ EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; +@@ -1157,7 +1157,7 @@ PxeBcCreateIp6Children ( + } + + // +- // Open SNP on the child handle BY_DRIVER. It will prevent any additionally ++ // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally + // layering to perform the experiment. + // + Status = gBS->OpenProtocol ( +@@ -1166,7 +1166,7 @@ PxeBcCreateIp6Children ( + (VOID **) &Snp, + This->DriverBindingHandle, + Private->Ip6Nic->Controller, +- EFI_OPEN_PROTOCOL_BY_DRIVER ++ EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; +-- +2.17.1 + diff --git a/edk2.spec b/edk2.spec index 4a11a7e..06289d2 100644 --- a/edk2.spec +++ b/edk2.spec @@ -35,7 +35,7 @@ Name: edk2 Version: %{edk2_date}git%{edk2_githash} -Release: 1%{dist} +Release: 2%{dist} Summary: EFI Development Kit II Group: Applications/Emulators @@ -76,6 +76,8 @@ Patch0019: 0019-BaseTools-Source-C-split-O2-to-BUILD_OPTFLAGS.patch Patch0020: 0020-BaseTools-Source-C-take-EXTRA_OPTFLAGS-from-the-call.patch Patch0021: 0021-BaseTools-Source-C-take-EXTRA_LDFLAGS-from-the-calle.patch Patch0022: 0022-BaseTools-VfrCompile-honor-EXTRA_LDFLAGS.patch +# Fix UEFI netboot +Patch0023: 0023-NetworkPkg-UefiPxeBcDxe-Add-EXCLUSIVE-attribute-when.patch %if 0%{?cross:1} # Tweak the tools_def to support cross-compiling. @@ -527,6 +529,9 @@ install qemu-ovmf-secureboot-%{qosb_version}/ovmf-vars-generator %{buildroot}%{_ %changelog +* Fri Nov 9 2018 Paolo Bonzini - 20180815gitcb5f4f45ce-2 +- Fix network boot via grub (bz 1648476) + * Fri Aug 31 2018 Cole Robinson - 20180815gitcb5f4f45ce-1 - Update to edk2 git cb5f4f45ce, edk2-stable201808