|
|
cc9195 |
From 1f2c35936d1731da26c3ed8d002785240853a742 Mon Sep 17 00:00:00 2001
|
|
|
cc9195 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
cc9195 |
Date: Wed, 7 Nov 2018 11:25:57 +0100
|
|
|
cc9195 |
Subject: [PATCH] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when
|
|
|
cc9195 |
opening SNP protocol installed by PXE.
|
|
|
cc9195 |
MIME-Version: 1.0
|
|
|
cc9195 |
Content-Type: text/plain; charset=UTF-8
|
|
|
cc9195 |
Content-Transfer-Encoding: 8bit
|
|
|
cc9195 |
|
|
|
cc9195 |
Message-id: <20181107102557.9106-2-lersek@redhat.com>
|
|
|
cc9195 |
Patchwork-id: 82937
|
|
|
cc9195 |
O-Subject: [RHEL8 edk2 PATCH 1/1] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE
|
|
|
cc9195 |
attribute when opening SNP protocol installed by PXE.
|
|
|
cc9195 |
Bugzilla: 1643377
|
|
|
cc9195 |
Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
cc9195 |
Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
cc9195 |
|
|
|
cc9195 |
From: "edk2-devel-bounces@lists.01.org" <edk2-devel-bounces@lists.01.org>
|
|
|
cc9195 |
|
|
|
cc9195 |
--v-- RHEL8 note start --v--
|
|
|
cc9195 |
|
|
|
cc9195 |
Please see the analysis for this backport in
|
|
|
cc9195 |
<https://bugzilla.redhat.com/show_bug.cgi?id=1643377#c20> through
|
|
|
cc9195 |
<https://bugzilla.redhat.com/show_bug.cgi?id=1643377#c25>.
|
|
|
cc9195 |
|
|
|
cc9195 |
There was a trivial conflict to resolve while cherry-picking the upstream
|
|
|
cc9195 |
commit; please refer to
|
|
|
cc9195 |
<https://bugzilla.redhat.com/show_bug.cgi?id=1643377#c28>.
|
|
|
cc9195 |
|
|
|
cc9195 |
--^-- RHEL8 note end --^--
|
|
|
cc9195 |
|
|
|
cc9195 |
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152
|
|
|
cc9195 |
|
|
|
cc9195 |
v2: Sync the same logic to Ipv6 and update code comments.
|
|
|
cc9195 |
|
|
|
cc9195 |
The PXE driver installs a SNP and open this SNP with attribute BY_DRIVER
|
|
|
cc9195 |
to avoid it being opened by MNP driver, this SNP is also expected not to
|
|
|
cc9195 |
be opened by other drivers with EXCLUSIVE attribute. In some cases, other
|
|
|
cc9195 |
drivers may happen to do this by error, and thus cause a system crash.
|
|
|
cc9195 |
This patch adds EXCLUSIVE attribute when opening SNP in PXE driver, and
|
|
|
cc9195 |
will reject all OpenProtocol requests by EXCLUSIVE.
|
|
|
cc9195 |
|
|
|
cc9195 |
Cc: Subramanian, Sriram <sriram-s@hpe.com>
|
|
|
cc9195 |
Cc: Ye Ting <ting.ye@intel.com>
|
|
|
cc9195 |
Cc: Fu Siyuan <siyuan.fu@intel.com>
|
|
|
cc9195 |
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
|
|
|
cc9195 |
Contributed-under: TianoCore Contribution Agreement 1.1
|
|
|
cc9195 |
Signed-off-by: Wang Fan <fan.wang@intel.com>
|
|
|
cc9195 |
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
|
|
|
cc9195 |
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
|
|
|
cc9195 |
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
|
|
|
cc9195 |
(cherry picked from commit cde5a72d365eff5b02b8330fef1c8d36fced08eb)
|
|
|
cc9195 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
cc9195 |
---
|
|
|
cc9195 |
NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 8 ++++----
|
|
|
cc9195 |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
cc9195 |
|
|
|
cc9195 |
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
|
|
|
cc9195 |
index 8dd787b..437cd6f 100644
|
|
|
cc9195 |
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
|
|
|
cc9195 |
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
|
|
|
cc9195 |
@@ -814,7 +814,7 @@ PxeBcCreateIp4Children (
|
|
|
cc9195 |
}
|
|
|
cc9195 |
|
|
|
cc9195 |
//
|
|
|
cc9195 |
- // Open SNP on the child handle BY_DRIVER. It will prevent any additionally
|
|
|
cc9195 |
+ // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
|
|
|
cc9195 |
// layering to perform the experiment.
|
|
|
cc9195 |
//
|
|
|
cc9195 |
Status = gBS->OpenProtocol (
|
|
|
cc9195 |
@@ -823,7 +823,7 @@ PxeBcCreateIp4Children (
|
|
|
cc9195 |
(VOID **) &Snp,
|
|
|
cc9195 |
This->DriverBindingHandle,
|
|
|
cc9195 |
Private->Ip4Nic->Controller,
|
|
|
cc9195 |
- EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
|
cc9195 |
+ EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE
|
|
|
cc9195 |
);
|
|
|
cc9195 |
if (EFI_ERROR (Status)) {
|
|
|
cc9195 |
goto ON_ERROR;
|
|
|
cc9195 |
@@ -1157,7 +1157,7 @@ PxeBcCreateIp6Children (
|
|
|
cc9195 |
}
|
|
|
cc9195 |
|
|
|
cc9195 |
//
|
|
|
cc9195 |
- // Open SNP on the child handle BY_DRIVER. It will prevent any additionally
|
|
|
cc9195 |
+ // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally
|
|
|
cc9195 |
// layering to perform the experiment.
|
|
|
cc9195 |
//
|
|
|
cc9195 |
Status = gBS->OpenProtocol (
|
|
|
cc9195 |
@@ -1166,7 +1166,7 @@ PxeBcCreateIp6Children (
|
|
|
cc9195 |
(VOID **) &Snp,
|
|
|
cc9195 |
This->DriverBindingHandle,
|
|
|
cc9195 |
Private->Ip6Nic->Controller,
|
|
|
cc9195 |
- EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
|
cc9195 |
+ EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE
|
|
|
cc9195 |
);
|
|
|
cc9195 |
if (EFI_ERROR (Status)) {
|
|
|
cc9195 |
goto ON_ERROR;
|
|
|
cc9195 |
--
|
|
|
cc9195 |
1.8.3.1
|
|
|
cc9195 |
|