From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069048.outbound.protection.outlook.com [40.92.69.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4CB1A21967BE3 for ; Wed, 14 Jun 2017 20:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UKmivJXZ8VF1xGce62zPRq47QNBhCuck1a4T6AOyXGU=; b=Pff9HoHq+337CHgKZtcjnNyhuqzwXTfcK1nffUJ7TerAwKc20Zze3h4ScIawq8MLyZHMVaGwsOSRzmsLnbnBNtk06GaZ8aopRIIE17xLU6uEFv9PVPhxlKzx4iTDZnY33yfIoSzPLk/ccY4KflP0E9B426HpcKkM70fxWwfcwJDtSbTi8l5KZLEZjip+Y+ou3mlwl7cHJ36CA7+3vYrhoOmtYTcwIgOF7BP0Avfxin4uU1SxNa5lv8scFohawwrRw3PXBQd4YTWXOrd14yrHJmc8rolFmHviEb/HRpdker9kexxrtwBWpkKF9ObUCuIGmT45A+GTiFf+IbBzds1Uaw== Received: from AM5EUR02FT058.eop-EUR02.prod.protection.outlook.com (10.152.8.51) by AM5EUR02HT149.eop-EUR02.prod.protection.outlook.com (10.152.9.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1143.11; Thu, 15 Jun 2017 03:27:49 +0000 Received: from AM5PR0601MB2579.eurprd06.prod.outlook.com (10.152.8.55) by AM5EUR02FT058.mail.protection.outlook.com (10.152.9.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12 via Frontend Transport; Thu, 15 Jun 2017 03:27:49 +0000 Received: from AM5PR0601MB2579.eurprd06.prod.outlook.com ([fe80::f181:3050:ac10:7409]) by AM5PR0601MB2579.eurprd06.prod.outlook.com ([fe80::f181:3050:ac10:7409%17]) with mapi id 15.01.1178.013; Thu, 15 Jun 2017 03:27:49 +0000 From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "edk2-devel@lists.01.org" CC: "Kinney, Michael D" Thread-Topic: Regarding UefiDriverEntryPoint unload handler Thread-Index: AdLlhzj9kv4S9+5cSlKrMjp1qtw2IA== Date: Thu, 15 Jun 2017 03:27:49 +0000 Message-ID: Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: lists.01.org; dkim=none (message not signed) header.d=none;lists.01.org; dmarc=none action=none header.from=outlook.com; x-incomingtopheadermarker: OriginalChecksum:11BEA6C73AB8BB302BE6D53D292031D8B21E525244DA8F7C2080D3D792B403D4; UpperCasedChecksum:8980D1274E62B404F662D1FCD113F1B753086E22E5A43FE7D4B673926E145F7A; SizeAsReceived:7290; Count:43 x-tmn: [HSvxKgizUSOz2nDSoHZbNn/KlPkn7t1lYvB+doLNRd73qTUTeswg9xl5z+QZDKs5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5EUR02HT149; 24:UcKksVso/dGZ1+SR6niRTAiBEi8ua5AzA9M5D2gQmG9fOLOyQUaPrRyGDMzGEYwCOZhd9IKawYva6J67cwXxrVvUBdO5Gh8OouPL+Z1HsOI=; 7:cRjMxPMaCe4ITNVKRnWIT8zkmRKt+aE29PjSbmqy7QAK2wMrdzmR2Xi103P8d55OMeoF/D3WK+Dm+x4SLT6CRv+pnKgLam2koEcE+4xCydWfp/iEZ7RIZJ3V+cYzdyzcLcq8/3+Jqj0J/JFY9FXe6wJMB98t4wWJgoyDmJgr19uTJamVNhcCATUlJ1GcR7JBJqNtvzLmJCEFQPMuQPVfTsWE+3BeAVLUKOuCvV3KCEJZzz0felYk9b/HW/7URi7Qyoq2yC7qWHVVPfH2NNsgzloC1+19q0rHZZb9Cc0DfY7MyB6cmqR3Bun8OEfU2Z6+ x-incomingheadercount: 43 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:AM5EUR02HT149; H:AM5PR0601MB2579.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-traffictypediagnostic: AM5EUR02HT149: x-ms-office365-filtering-correlation-id: 5dbcdc62-a873-44a0-5301-08d4b39e7fb8 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1603101448)(1601125374)(1701031045); SRVR:AM5EUR02HT149; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031); SRVR:AM5EUR02HT149; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM5EUR02HT149; x-forefront-prvs: 0339F89554 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jun 2017 03:27:49.3979 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT149 Subject: Re: Regarding UefiDriverEntryPoint unload handler X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jun 2017 03:26:35 -0000 Content-Language: de-DE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hey Mike, "if UnloadImage() is called and the Unload field is NULL, it returns an EFI= _UNSUPPORTED." This is the part I missed, my example is impossible in this case. Thanks, Marvin. -----Urspr=FCngliche Nachricht----- Von: Kinney, Michael D [mailto:michael.d.kinney@intel.com]=20 Gesendet: Donnerstag, 15. Juni 2017 04:51 An: Marvin H?user ; edk2-devel@lists.01.org; Ki= nney, Michael D Betreff: RE: Regarding UefiDriverEntryPoint unload handler Hi Marvin, Yes. This is intentional. If MODULE_UNLOAD is not provided, then the modu= le can never be unloaded. =20 The LoadImage() services initializes the Unload field to NULL, and if Unloa= dImage() is called and the Unload field is NULL, it returns an EFI_UNSUPPOR= TED. I do not think the case you describer is possible. If ProcessModuleUnloadL= ist() returns an error, then ProcessLibraryDestructorList()is not called. Since the module is not unloaded, it is still in allocated memory. How wou= ld the protocol point to a freed buffer? Mike -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Marv= in H?user Sent: Wednesday, June 14, 2017 6:41 PM To: edk2-devel@lists.01.org Subject: [edk2] Regarding UefiDriverEntryPoint unload handler Dear developers, While performing some research tasks, I noticed that when UefiDriverEntryPo= int's _gDriverUnloadImageCount is 0 (only MODULE_UNLOAD entries are count, = DESTRUCTOR as they are used with libraries are not, as far as I can see), E= FI_LOADED_IMAGE_PROTOCOL.Unload is not set, even if libraries with destruct= ors are included by the built module. Is this intentional, so, is a module without a MODULE_UNLOAD property in it= s build file considered a module that does not support being unloaded? If s= o, why is EFI_LOADED_IMAGE_PROTOCOL.Unload not set to a dummy that returns = an EFI error code? For example, DxeDebugPrintErrorLevelLib installs a protocol interface in it= s CONSTRUCTOR function. When this library is included in a module without a= MODULE_UNLOAD property and that module is unloaded, the DxeDebugPrintError= LevelLib DESTRUCTOR function, which uninstalls the interface, is never call= ed and hence the interface remains in the protocol database, despite it poi= nting to a memory location that is now free. If it is called, the behavior = is obviously undefined. Did I understand something incorrectly, are these modules not supposed to b= e unloadable or is this a bug? Thank you, Marvin. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel