From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067088.outbound.protection.outlook.com [40.92.67.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4939D21A16EC1 for ; Wed, 14 Jun 2017 18:40:04 -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=Z/NwIY/aggu0a9Gbvvi0T9Ac3xXuUM6r1V8Pfjtw8kg=; b=FkJAwYGVwup1Auz+KVPbAqP+2f9TBPMVnzMu8lRQquDj/6bsXRkv+e6RX1QTBImpb8RwHJ9hlIpaBGmtQb49PGjgnjfeeiSK6CTvRsgBNkbWIUjvmD5j+gIIbikEQTJ3CX5u3aWD3Ru606yHMASShTykTYR8OTMGGj1Lgw/4Omh1uEfVlciC5FV1t+9ghjhOHqEvgXbnXdj4UnrzLy2Aona7R6q/lbozuHQzvvzh0o1Wtawpj6M411o5BJzLr+dqZKr1RRitmg4L3ky5zWBUiKeYITn/0eI10Df2BLLmoqkC/uRlXYp02GaTWJGLIfNvIreEg5ix/Rj9KQTrGXEaYw== Received: from VE1EUR02FT034.eop-EUR02.prod.protection.outlook.com (10.152.12.52) by VE1EUR02HT077.eop-EUR02.prod.protection.outlook.com (10.152.13.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1157.12; Thu, 15 Jun 2017 01:41:18 +0000 Received: from AM5PR0601MB2579.eurprd06.prod.outlook.com (10.152.12.52) by VE1EUR02FT034.mail.protection.outlook.com (10.152.12.125) 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 01:41:18 +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 01:41:18 +0000 From: Marvin H?user To: "edk2-devel@lists.01.org" Thread-Topic: Regarding UefiDriverEntryPoint unload handler Thread-Index: AdLldyEIkv4S9+5cSlKrMjp1qtw2IA== Date: Thu, 15 Jun 2017 01:41:18 +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:49E0F06E51644F4494547214060587750B8AEA55C926DCBB33A15B94C39E33D6; UpperCasedChecksum:0D3B73A2F02E4D1895D85A019FB6C419A9E5C20BDE470B7012B6E8B05013B771; SizeAsReceived:7227; Count:42 x-tmn: [s9ExefoZH5p4axMZePsYL3KZy4gufaL1R4P4l4pvKhM3pxT8n5v/72zcr0vHh0AA] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR02HT077; 24:vMZV77+yCgt09XhiDI5QKHeiMTTPk7KF+5s4gcD1SaSd8ukCwh5L7usCSwC6xjc6S7p0xPtL+lmzphvBW1VoVgohoiEdGowahjoDWHzbcLg=; 7:42XX4NjC5MnZ/TjeEhF+fU1aLnkuoHT7Dkeuw9r2KxVmWFVPLoZNM5eeADxKpivYKqzizeJ/IS2KS8poiin8KOwT7nYeeTSg251+/DyiLzZ5TJooc1+RZoh4q6ZCrf844C/8gt1XpE0SKPvKkEV49o0HxaFNI2jtrNXpeidZ0rnBhfBY0IX90K/N/noXRTbOoVErIt88JSquIaB3StMe8/lsNuVK0kmgEjiiqMNmY7EriFOXVQpTsYvCj97lRT7ycdxZjGnQsUL9Ym8LBpKaGweo82qDEnXrvxz150xlfIu/SY7LT7Gp/s4jk0q+gb9Y x-incomingheadercount: 42 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR02HT077; H:AM5PR0601MB2579.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-traffictypediagnostic: VE1EUR02HT077: x-ms-office365-filtering-correlation-id: 630902a9-88a8-4ee4-9b12-08d4b38f9e64 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1601125374)(1603101448)(1701031045); SRVR:VE1EUR02HT077; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031); SRVR:VE1EUR02HT077; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VE1EUR02HT077; 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 01:41:18.3921 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT077 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: 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 01:40:04 -0000 Content-Language: de-DE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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.