From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.241.140.75; helo=g4t3426.houston.hpe.com; envelope-from=sriram-s@hpe.com; receiver=edk2-devel@lists.01.org Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3A91A21962301 for ; Fri, 14 Sep 2018 01:50:49 -0700 (PDT) Received: from G9W8455.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3426.houston.hpe.com (Postfix) with ESMTPS id 5ECE961; Fri, 14 Sep 2018 08:50:48 +0000 (UTC) Received: from G4W9119.americas.hpqcorp.net (2002:10d2:14d6::10d2:14d6) by G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 14 Sep 2018 08:50:48 +0000 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (15.241.52.11) by G4W9119.americas.hpqcorp.net (16.210.20.214) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 14 Sep 2018 08:50:47 +0000 Received: from DF4PR8401MB1019.NAMPRD84.PROD.OUTLOOK.COM (10.169.87.139) by DF4PR8401MB1004.NAMPRD84.PROD.OUTLOOK.COM (10.169.87.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Fri, 14 Sep 2018 08:50:46 +0000 Received: from DF4PR8401MB1019.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5867:cb5:b9d:5a70]) by DF4PR8401MB1019.NAMPRD84.PROD.OUTLOOK.COM ([fe80::5867:cb5:b9d:5a70%9]) with mapi id 15.20.1143.014; Fri, 14 Sep 2018 08:50:46 +0000 From: "Subramanian, Sriram" To: Wang Fan , "edk2-devel@lists.01.org" CC: "Subramanian@mx0b-002e3701.pphosted.com" , Ye Ting , "Fu Siyuan" , Wu Jiaxin Thread-Topic: [Patch v2] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE. Thread-Index: AQHUTARlXKBIuJqmlEq9aLOa74yIhKTvdQJA Date: Fri, 14 Sep 2018 08:50:46 +0000 Message-ID: References: <20180914082415.800-1-fan.wang@intel.com> In-Reply-To: <20180914082415.800-1-fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sriram-s@hpe.com; x-originating-ip: [16.242.235.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DF4PR8401MB1004; 6:coSMjxvQousUUAjn5UZZE7AShzM47wm4N9MflHdQSL+gwyRGPaozAzbGqRm/eof2ODtiRH9GE2sV1gEgn4BsoEBMyt7Wnz7gVCxVW7oK2zIXWtFyJHLsuL2uqM87+kvtatGqS6inXGkJsIPFjo999uo66pH1FBT9WNTM40HsdZBC2EeukvZtPeoMCgUZNXakB8yWvuM1lr95OeIgVTg4t5hvKtGOiv7rqnEo0eWpmT7O4OMNc4+aeuAG+S6GWPL9OThWUpEGq/9bfM7bU7tZg8D6GRIza5G3MdfhqMZhSoPjyE/5T2RAShTMf+GBExwZDArRLIPnCRlq5lWJ7UiWwKJmSy4orDk3cFFHNvebMRDNUQ2xEJUOL7nysoBZVY5M7reNL5hW4Nm2WRACspfTuT7n7mOL5ROU+oHw/LSuPW/QPvuIq5/l1bNh59hXpKFqjki+PSpp3Jzv5anUGsschw==; 5:D47fUbpt52HXurandFH0OgFyi3YY0ijPXRehSHlK9LXurfCdEVJRKIpwEl0l7HiwGp9uPM2x6lgHEmh3MmGgkRivLoAMf4X33edYjdUaejjj18XSr+JmwJhTwPA9ItlaP5tYjpy6bwUawhgNzn2ygZDcBfZ/wbRfgtEbdqOuR9w=; 7:iEcC720tDQSPTWlSmXaQAVpIlEu/vMwVtwwQDPFayHD13F5PGt/3sJWjc0VmG5ghHJGpRrA+iAp+Wm/Dxk98xw4UoNosKAuSU2kRPbIlfpkZPFyUVd0dmFDNL9G4o8/8qy7cnbvKbgBO91d1abUNL0fImJZDKI034m6Xc9FwN918xXyzLo4v8FngOTDPjKrASG6s+bHr/Ad/Y/ufY5dy1zkFjyOugKiqNrHTFmKwUWuZ7Z4jE8ajcs92I3Ph952I x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: b125c9a5-e4d8-48e4-5fa7-08d61a1f29b2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DF4PR8401MB1004; x-ms-traffictypediagnostic: DF4PR8401MB1004: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(222181515654134)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:DF4PR8401MB1004; BCL:0; PCL:0; RULEID:; SRVR:DF4PR8401MB1004; x-forefront-prvs: 07954CC105 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(136003)(366004)(346002)(396003)(376002)(39860400002)(13464003)(199004)(189003)(5250100002)(486006)(3846002)(11346002)(6116002)(446003)(476003)(9686003)(8676002)(4326008)(55016002)(33656002)(6306002)(6436002)(2501003)(105586002)(53936002)(106356001)(53546011)(6506007)(110136005)(316002)(25786009)(66066001)(54906003)(8936002)(229853002)(102836004)(99286004)(81166006)(76176011)(7696005)(81156014)(2900100001)(26005)(97736004)(14444005)(966005)(2906002)(14454004)(5660300001)(45954006)(86362001)(575784001)(478600001)(256004)(19627235002)(186003)(68736007)(74316002)(305945005)(6246003)(7736002); DIR:OUT; SFP:1102; SCL:1; SRVR:DF4PR8401MB1004; H:DF4PR8401MB1019.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: cmjxRu8JRNa3ADG6XPmOWrQ0gEmGpSnWu4112XoqzGyIYomgGpvJofvX8cMO82XiZlHziDL6c7VrmNC6G//4JMjEQ6Hm+sDFSMvYFOqOQ7l7vd10pP17WP+Tfg1pDSE3DnHm1untBIMplDGuXSYHOATvbs2BLv1N4+g+Av0O45HPkg9KjJyrgEr/pqVYjBtdJVC0E57HRhihbKbX7kXykVAaBJnfHtEPxGvn8KJrPZdHNQDsUExa7k0IOZubSnTpZhwEFkf8NmtHLtGJ+dsyBvz5G30nTmbBrMDaztHYi5IiMko/3EOF6eVJdrT9bqGKcjL99qfCMBMybGy1y5aGzFrZYIz7DyqFDnr+pnwT3vk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b125c9a5-e4d8-48e4-5fa7-08d61a1f29b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2018 08:50:46.4457 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1004 X-OriginatorOrg: hpe.com Subject: Re: [Patch v2] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2018 08:50:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sriram Subramanian -----Original Message----- From: Wang Fan [mailto:fan.wang@intel.com]=20 Sent: Friday, September 14, 2018 1:54 PM To: edk2-devel@lists.01.org Cc: Subramanian@mx0b-002e3701.pphosted.com; Subramanian, Sriram ; Ye Ting ; Fu Siyuan ; Wu J= iaxin Subject: [Patch v2] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when = opening SNP protocol installed by PXE. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1152 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 --- NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDx= e/PxeBcDriver.c index bc9dc914f3..0ab640beca 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c @@ -812,20 +812,20 @@ PxeBcCreateIp4Children ( if (EFI_ERROR (Status)) { goto ON_ERROR; } =20 // - // Open SNP on the child handle BY_DRIVER. It will prevent any additio= nally + // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent a= ny additionally // layering to perform the experiment. // Status =3D gBS->OpenProtocol ( Private->Ip4Nic->Controller, &gEfiSimpleNetworkProtocolGuid, (VOID **) &Snp, This->DriverBindingHandle, Private->Ip4Nic->Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER + EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIV= E ); if (EFI_ERROR (Status)) { goto ON_ERROR; } } @@ -1155,20 +1155,20 @@ PxeBcCreateIp6Children ( if (EFI_ERROR (Status)) { goto ON_ERROR; } =20 // - // Open SNP on the child handle BY_DRIVER. It will prevent any additio= nally + // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent a= ny additionally // layering to perform the experiment. // Status =3D gBS->OpenProtocol ( Private->Ip6Nic->Controller, &gEfiSimpleNetworkProtocolGuid, (VOID **) &Snp, This->DriverBindingHandle, Private->Ip6Nic->Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER + EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIV= E ); if (EFI_ERROR (Status)) { goto ON_ERROR; } } --=20 2.16.2.windows.1