From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=203.18.50.4; helo=nat-hk.nvidia.com; envelope-from=ashishsingha@nvidia.com; receiver=edk2-devel@lists.01.org Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) (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 64709211ADA51 for ; Thu, 3 Jan 2019 16:16:29 -0800 (PST) Received: from hkpgpgate101.nvidia.com (Not Verified[10.18.92.100]) by nat-hk.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 04 Jan 2019 08:16:27 +0800 Received: from HKMAIL104.nvidia.com ([10.18.16.13]) by hkpgpgate101.nvidia.com (PGP Universal service); Thu, 03 Jan 2019 16:16:27 -0800 X-PGP-Universal: processed; by hkpgpgate101.nvidia.com on Thu, 03 Jan 2019 16:16:27 -0800 Received: from DRBGMAIL103.nvidia.com (10.18.16.22) by HKMAIL104.nvidia.com (10.18.16.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 4 Jan 2019 00:16:26 +0000 Received: from HKMAIL102.nvidia.com (10.18.16.11) by DRBGMAIL103.nvidia.com (10.18.16.22) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 4 Jan 2019 00:16:24 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.57) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 4 Jan 2019 00:16:24 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com (20.177.125.220) by BYAPR12MB2870.namprd12.prod.outlook.com (20.179.90.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Fri, 4 Jan 2019 00:16:06 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::d51a:3dbb:3b90:178b]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::d51a:3dbb:3b90:178b%3]) with mapi id 15.20.1471.019; Fri, 4 Jan 2019 00:16:06 +0000 From: Ashish Singhal To: "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Fu, Siyuan" , "Wu, Jiaxin" Thread-Topic: Uninstalling Invalid Protocol Interfaces Thread-Index: AdSjtn8ScFpTlPkrTXiCI2Fb6Dn4GwACtD8QAABPn1A= Date: Fri, 4 Jan 2019 00:16:05 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Enabled=True; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SiteId=43083d15-7273-40c1-b7db-39efd9ccc17a; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Owner=ashishsingha@nvidia.com; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_SetDate=2019-01-04T00:16:04.5510557Z; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Name=Unrestricted; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Application=Microsoft Azure Information Protection; MSIP_Label_6b558183-044c-4105-8d9c-cea02a2a3d86_Extended_MSFT_Method=Automatic; Sensitivity=Unrestricted authentication-results: spf=none (sender IP is ) smtp.mailfrom=ashishsingha@nvidia.com; x-originating-ip: [216.228.112.22] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR12MB2870; 6:Av5W3VrlO8aX677rzu1aEHrjAA++FrYFvm0492o/Y97ygoa8Lbe2Ug98mEIMZuuzTmrTW+22lARmQJJlpXCC154hVLaWklrsx7P9vVbia1L+GlvZ0G6/EPLqByjW50SnLNxdjbxgnxjvkVfCvXmh6TFyOL/wADhlkiHcbDHhG3X3MBtbkxZZYyRIu4AhE9vOSsyxNP0D9LsrAHNutJQwPZKS/DkAiUPWCxBoMcjj1fAfPWsCueQQIf6r/fzD+ZLSI2hc26ZThtNMbJ6k1cnrO5P0WSadFx2Fwl5SxUl7xBOwepW/Xu4zs1LnftHtrbwL55fQePrDdkF+zo1/vwRNPvmz6SUyum6blmBBHqkl5GRzSi/Ugl8tMStSqN6O1LYQMWj6L2/UJZkSs8gm/lOd1/tE3CkbizF3FV+N9cMjnsT0E+RsfsjPLgHw+nVXqbUbAaUOUVYFn5EC/rcYkO9qmg==; 5:x+8tHHiIPN2glSK3H2bSlGwDzbv3uyyoyX5i1N+kKeUb9Y8P9ZyZ+jzDFEBLYn6vCiO3xRYx9KzToc83+SnivUv5VBMgTlC9B3Rp+rAmJR+Jg6T3NtQrAlM5WVNDgFz3SpwsWc1V4vD8/4k4ddGIwKwlhwJ3dbA1TVuVYnkiycFNMWHwnCaEwGh2lWLXOByJrngg8PnIaLbJQXKzu0PhLw==; 7:7LlJn+/i97CBmoJ+HZq94IpbOsD3ypb+5eF7GuaoMakLwlIeaAhcNwXjJk8qoJhOshbAVaM8h+c6rHiQ70SriNYTfhRILQCCX/o3+seltNswAkGDiuBrlKmbFk0k5InhtYUWxoo3m8cZm3ERoU/sPQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 7b897275-9082-435a-b3e0-08d671d9d1bd x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR12MB2870; x-ms-traffictypediagnostic: BYAPR12MB2870: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:BYAPR12MB2870; BCL:0; PCL:0; RULEID:; SRVR:BYAPR12MB2870; x-forefront-prvs: 0907F58A24 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(136003)(39850400004)(366004)(199004)(189003)(606006)(6506007)(53546011)(76176011)(186003)(790700001)(26005)(7696005)(102836004)(6116002)(3480700005)(3846002)(229853002)(7736002)(8676002)(81156014)(81166006)(8936002)(53936002)(106356001)(105586002)(25786009)(9326002)(33656002)(4326008)(71200400001)(71190400001)(6246003)(2906002)(9686003)(54896002)(6306002)(236005)(99286004)(54906003)(966005)(478600001)(86362001)(476003)(5660300001)(256004)(97736004)(446003)(14454004)(2501003)(68736007)(486006)(6436002)(316002)(66066001)(19627235002)(110136005)(74316002)(55016002)(11346002)(14444005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB2870; H:BYAPR12MB2743.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: w2o8Fg1YlotLfPyMHeoracD6rCDeGHDpiUSsj3+Lpm3XXzqJhEVAwBOu2kvSJUcstHudxqwiSpexwafPLdVo38DmwGD0DA4VH5gPSbVRwaC/BPdeJodAjjVJNUe+3kTRt2XhHhDFBehVBsWWFCun7GU5eOdjKDPaOk5Z+4bcA1KrLJbC7Gdo4POS2eI82EEfNgW0xzSgMNYDnD1zkRNll0d2lsBbrB8J4LpUu4za6+bzDisfz9Yxcr+RjjXXBMUM1H643/OFezlKw8L85prFkvInO0YDhau+XR8YyGcfYuxEosYltpMUdoaHycNhjCIB spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7b897275-9082-435a-b3e0-08d671d9d1bd X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jan 2019 00:16:05.8966 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2870 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1546560987; bh=M1FI6idK7CNLXLKc/XIGw+cgirTYqVs/IWmYqC1G7cY=; h=X-PGP-Universal:From:To:CC:Subject:Thread-Topic:Thread-Index:Date: Message-ID:References:In-Reply-To:Accept-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:msip_labels:authentication-results: x-originating-ip:x-ms-publictraffictype: x-microsoft-exchange-diagnostics: x-ms-exchange-antispam-srfa-diagnostics: x-ms-office365-filtering-correlation-id:x-microsoft-antispam: x-ms-traffictypediagnostic:x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test:x-forefront-prvs: x-forefront-antispam-report:received-spf: x-ms-exchange-senderadcheck:x-microsoft-antispam-message-info: spamdiagnosticoutput:spamdiagnosticmetadata:MIME-Version: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg: Content-Language:Content-Type; b=Ol2OnauRrJ78nF1czjqjN6FAtYNw3AGVhePFSS7m0BQIBHZUZgT3qIJad8/Gdu5pt Cv8vtgPIwrqXLdoHw1Jy5tL6RaFaFNqCUVSUxf9p+5cqX7FaSZEq+EdTgjyFhz0vk5 Jz7UeWw27anDYasimVva8Kv5HXm9Qk52E2cywh3wp8L/DxKG/0dOdefuyHGYypdq2q OhOt/96emAYGrH2eZ45i+SnwwFjxbwiIdiJEkCYLk+j3Kbgn9N9GMTTqA2DT+sHnnD sV8oyt/oYEflyVEjUdzs44nt+2Exh6jfFTCiAI+7DUJvnaD15i6J3WoQe/HEHhFQXR T5RubAbwBsCeQ== X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: Uninstalling Invalid Protocol Interfaces 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, 04 Jan 2019 00:16:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Mike, Call to UninstallMultipleProtocolInterfaces at https://github.com/tianocore= /edk2/blob/master/NetworkPkg/IScsiDxe/IScsiDriver.c#L1864 fails because the= component name interface may not be installed depending on the state of PC= D. Thanks Ashish From: Kinney, Michael D Sent: Thursday, January 3, 2019 5:09 PM To: Ashish Singhal ; edk2-devel@lists.01.org; Kinn= ey, Michael D Cc: Gao, Liming ; Fu, Siyuan ; W= u, Jiaxin Subject: RE: Uninstalling Invalid Protocol Interfaces Hi Ashish, Can you provide a pointer to the UninstallMultipleProtocolInterfaces() call= that is causing this failure? I agree that the UefiLib could provide additional services to simplify the = implementation of the unload handlers. Matching the UefiLib APIs that inst= all the Uefi Driver Model protocol would be useful, so the driver entry poi= nt and the driver unload functions can use matching APIs. Mike From: Ashish Singhal [mailto:ashishsingha@nvidia.com] Sent: Thursday, January 3, 2019 3:39 PM To: edk2-devel@lists.01.org Cc: Kinney, Michael D >; Gao, Liming >= ; Fu, Siyuan >; Wu, Jiaxin = > Subject: Uninstalling Invalid Protocol Interfaces Hello, As part of moving from MdeModulePkg implementation of IScsiDxe to the imple= mentation in NetworkPkg, I started hitting exception in the driver loaded a= fter IScsiDxe if IScsiDxe's installation fails for some reason. Upon debugg= ing, I found out that calls to UninstallMultipleProtocolInterfaces as part = of Error 2 as well Error 1 fail while trying to uninstall component name pr= otocol-interface pair and return error code EFI_INVALID_PARAMETER. As per U= ninstallMultipleProtocolInterfaces's documentation, if uninstallation of an= y of the input protocol-interface pair fails, it will reinstall any just un= installed protocol and return EFI_INVALID_PARAMETER which causes the cleanu= p of this driver corrupt leading to failure in next driver getting loaded. = The reason of failure in UninstallMultipleProtocolInterfaces is because the= driver uses EfiLibInstallDriverBindingComponentName2 to install interfaces= which may not install component name interfaces depending on the value of = PCDs PcdComponentNameDisable and PcdComponentName2Disable. I have the follo= wing proposals to get around this issue. 1. Instead of calling UninstallMultipleProtocolInterfaces once and list = all protocol-interface pairs, do it sequentially for every pair so that the= once which was installed correctly, gets uninstalled instead of getting re= installed because of a failure uninstalling another pair. This would howeve= r make us not really use use UninstallMultipleProtocolInterfaces API to its= full caliber. 2. In UEFILib, add a function EfiLibUninstallDriverBindingComponentName2= for uninstalling protocol interfaces taking into consideration the state o= f PCDs PcdComponentNameDisable and PcdComponentName2Disable. 3. In UEFILib, add uninstall functions for all corresponding install API= s to get coverage for all scenarios. I would certainly prefer option 2 or 3 as they seem to be more correct and = would provide a for all drivers which may hit the issue. I am happy to make= the code changes as needed and suggested by the maintainers. Thanks Ashish ________________________________ This email message is for the sole use of the intended recipient(s) and may= contain confidential information. Any unauthorized review, use, disclosur= e or distribution is prohibited. If you are not the intended recipient, pl= ease contact the sender by reply email and destroy all copies of the origin= al message. ________________________________