public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.
@ 2018-09-14  7:38 Wang Fan
  2018-09-14  7:44 ` Wu, Jiaxin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wang Fan @ 2018-09-14  7:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Wu Jiaxin

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152

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: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index bc9dc914f3..1a9671d373 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -821,11 +821,11 @@ PxeBcCreateIp4Children (
                     Private->Ip4Nic->Controller,
                     &gEfiSimpleNetworkProtocolGuid,
                     (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;
     }
   }
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.
  2018-09-14  7:38 [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE Wang Fan
@ 2018-09-14  7:44 ` Wu, Jiaxin
  2018-09-14  8:05 ` Subramanian, Sriram
  2018-09-17  0:32 ` Fu, Siyuan
  2 siblings, 0 replies; 5+ messages in thread
From: Wu, Jiaxin @ 2018-09-14  7:44 UTC (permalink / raw)
  To: edk2-devel, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan

Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

Thanks,
Jiaxin

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org]
> Sent: Friday, September 14, 2018 3:39 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE
> attribute when opening SNP protocol installed by PXE.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152
> 
> 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: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Wang Fan <fan.wang@intel.com>
> ---
>  NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> index bc9dc914f3..1a9671d373 100644
> --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> @@ -821,11 +821,11 @@ PxeBcCreateIp4Children (
>                      Private->Ip4Nic->Controller,
>                      &gEfiSimpleNetworkProtocolGuid,
>                      (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;
>      }
>    }
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.
  2018-09-14  7:38 [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE Wang Fan
  2018-09-14  7:44 ` Wu, Jiaxin
@ 2018-09-14  8:05 ` Subramanian, Sriram
  2018-09-14  8:07   ` Wang, Fan
  2018-09-17  0:32 ` Fu, Siyuan
  2 siblings, 1 reply; 5+ messages in thread
From: Subramanian, Sriram @ 2018-09-14  8:05 UTC (permalink / raw)
  To: Wang Fan, edk2-devel@lists.01.org; +Cc: Ye Ting, Fu Siyuan, Wu Jiaxin

1. We need to update the comments as well:
    //
    // Open SNP on the child handle BY_DRIVER. It will prevent any additionally
    // layering to perform the experiment.
    //

2. PxeBcCreateIp6Children() will also need to follow the same logic, in my opinion.

Thanks,
Sriram.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Wang Fan
Sent: Friday, September 14, 2018 1:09 PM
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>; Fu Siyuan <siyuan.fu@intel.com>; Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152

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: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index bc9dc914f3..1a9671d373 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -821,11 +821,11 @@ PxeBcCreateIp4Children (
                     Private->Ip4Nic->Controller,
                     &gEfiSimpleNetworkProtocolGuid,
                     (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;
     }
   }
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.
  2018-09-14  8:05 ` Subramanian, Sriram
@ 2018-09-14  8:07   ` Wang, Fan
  0 siblings, 0 replies; 5+ messages in thread
From: Wang, Fan @ 2018-09-14  8:07 UTC (permalink / raw)
  To: Subramanian, Sriram, edk2-devel@lists.01.org
  Cc: Ye, Ting, Fu, Siyuan, Wu, Jiaxin

Thanks, Shiram, I missed that.

Best Regards
Fan

-----Original Message-----
From: Subramanian, Sriram [mailto:sriram-s@hpe.com] 
Sent: Friday, September 14, 2018 4:05 PM
To: Wang, Fan <fan.wang@intel.com>; edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: RE: [edk2] [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.

1. We need to update the comments as well:
    //
    // Open SNP on the child handle BY_DRIVER. It will prevent any additionally
    // layering to perform the experiment.
    //

2. PxeBcCreateIp6Children() will also need to follow the same logic, in my opinion.

Thanks,
Sriram.

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Wang Fan
Sent: Friday, September 14, 2018 1:09 PM
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>; Fu Siyuan <siyuan.fu@intel.com>; Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152

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: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index bc9dc914f3..1a9671d373 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -821,11 +821,11 @@ PxeBcCreateIp4Children (
                     Private->Ip4Nic->Controller,
                     &gEfiSimpleNetworkProtocolGuid,
                     (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;
     }
   }
--
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE.
  2018-09-14  7:38 [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE Wang Fan
  2018-09-14  7:44 ` Wu, Jiaxin
  2018-09-14  8:05 ` Subramanian, Sriram
@ 2018-09-17  0:32 ` Fu, Siyuan
  2 siblings, 0 replies; 5+ messages in thread
From: Fu, Siyuan @ 2018-09-17  0:32 UTC (permalink / raw)
  To: edk2-devel, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wu, Jiaxin

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org]
> Sent: Friday, September 14, 2018 3:39 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute
> when opening SNP protocol installed by PXE.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152
> 
> 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: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Wang Fan <fan.wang@intel.com>
> ---
>  NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> index bc9dc914f3..1a9671d373 100644
> --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
> @@ -821,11 +821,11 @@ PxeBcCreateIp4Children (
>                      Private->Ip4Nic->Controller,
>                      &gEfiSimpleNetworkProtocolGuid,
>                      (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;
>      }
>    }
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-17  0:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-14  7:38 [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE Wang Fan
2018-09-14  7:44 ` Wu, Jiaxin
2018-09-14  8:05 ` Subramanian, Sriram
2018-09-14  8:07   ` Wang, Fan
2018-09-17  0:32 ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox