From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in4.apple.com (mail-out4.apple.com [17.151.62.26]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E785D1A1DF6 for ; Mon, 8 Aug 2016 19:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1470708436; x=2334622036; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-transfer-encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=27fcjqEEAUb00+gDeY0LGhOsmhscxDJdL9xKfZj+BnI=; b=I2lHEX47jYq7LBFyhlNIsjnRftfX7aEnpLDFikEwtymgOCtWYqY5rBLxW7nuqtej zUrZq5My2/0S6PJEM44Qr49J8l3IGzDrU2eJootGTgfoLtjPJokHEe0No3yTOYTt 84elLJoFwtHrFHzvH+5n0L1meYarkYooFAjubi1kSPXRNLJwSvs307vGOdASnWDQ r1A0XzwM1qJaLxa6CwSOYF8BO7aw179LoocJf61aqP0A1q/b74cx0j998WsQGRyO PceIWUV4HCSZcO6wJXB8u5fAznu+q5OSJvhobV6tMO6qJ52hifDR6c+pZB7hJ4iD rgiOI6n8ga/ja4++4wjLBQ==; Received: from relay3.apple.com (relay3.apple.com [17.128.113.83]) by mail-in4.apple.com (Apple Secure Mail Relay) with SMTP id 30.84.07433.4DA39A75; Mon, 8 Aug 2016 19:07:16 -0700 (PDT) X-AuditID: 11973e12-f79b16d000001d09-f4-57a93ad4603e Received: from nwk-mmpp-sz08.apple.com (nwk-mmpp-sz08.apple.com [17.128.115.25]) by relay3.apple.com (Apple SCV relay) with SMTP id 6F.DE.18578.4DA39A75; Mon, 8 Aug 2016 19:07:16 -0700 (PDT) MIME-version: 1.0 Received: from [17.153.51.123] by nwk-mmpp-sz08.apple.com (Oracle Communications Messaging Server 8.0.1.1.0 64bit (built Jun 15 2016)) with ESMTPSA id <0OBM003T3DW3IZA0@nwk-mmpp-sz08.apple.com>; Mon, 08 Aug 2016 19:07:16 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish In-reply-to: <0C09AFA07DD0434D9E2A0C6AEB048310036A1BCF@shsmsx102.ccr.corp.intel.com> Date: Mon, 08 Aug 2016 19:07:04 -0700 Cc: edk2-devel Message-id: <33692B19-74EE-4C13-8AE3-1C92B74836C3@apple.com> References: <776695E1-E864-42F4-A633-B86FB913A510@apple.com> <0C09AFA07DD0434D9E2A0C6AEB048310036A1BCF@shsmsx102.ccr.corp.intel.com> To: "Zeng, Star" X-Mailer: Apple Mail (2.3112) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsUi2FAYrHvFamW4wcOPihZ7Dh1lttjXa+3A 5LF4z0smj+7Z/1gCmKK4bFJSczLLUov07RK4MqaufMRYcF6m4tKTt0wNjK/Fuxg5OSQETCS2 77zIDmGLSVy4t56ti5GLQ0hgL6PE+rYpzDBFXU83MEMkDjJKnHjXwwKS4BUQlPgx+R6QzcHB LCAvcfC8LEiYWUBL4vujVhaI+neMEq+XzmACSQgLiEu8O7MJbJCwwCxGiRcLZoANYhNQllgx /wPYGZwCYRLtb3YxgwxlEVCVmLfIGGKohsTX1dvZIfbaSEw49IQRYkEbo8TP/RvAFogIqEns Xb0L6h1ZiX0bFoC9IyGwhU3i79921gmMIrOQHD4L4fBZSA5fwMi8ilEoNzEzRzczz0QvsaAg J1UvOT93EyMo5KfbCe1gPLXK6hCjAAejEg/vheUrwoVYE8uKK3MPMUpzsCiJ85osAwoJpCeW pGanphakFsUXleakFh9iZOLglGpgXG30+duxzAVnj6kbBu+Nv3Np6R471bII/p77TB6CLOl6 Fa5sz2eJvRA5tO/BvuanGgxtJU/PMdwzvph+pivc7JlNodkmX1/jj0wWq5rOljs8X5bs+WPF ybKXsxaKGFTvWb78T9u2PNGuIr7NM1rUnat+LDwld/R7NfeKJwZayvZ3IhO8Ev2VlFiKMxIN tZiLihMBTkO6yloCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42IRbCiW1L1itTLc4OpLOYs9h44yW+zrtXZg 8li85yWTR/fsfywBTFFcNimpOZllqUX6dglcGVNXPmIsOC9TcenJW6YGxtfiXYycHBICJhJd TzcwQ9hiEhfurWfrYuTiEBI4yChx4l0PC0iCV0BQ4sfke0A2BwezgLzEwfOyIGFmAS2J749a WSDq3zFKvF46gwkkISwgLvHuzCZmkISwwCxGiRcLZoANYhNQllgx/wM7iM0pECbR/mYXM8hQ FgFViXmLjCGGakh8Xb2dHWKvjcSEQ08YIRa0MUr83L8BbIGIgJrE3tW72CGulpXYt2EB2wRG wVlIbp2FcOssJLcuYGRexShQlJqTWGmsl1hQkJOql5yfu4kRHKKFwTsY/yyzOsQowMGoxMN7 YfmKcCHWxLLiytxDjBIczEoivPEWK8OFeFMSK6tSi/Lji0pzUosPMSYD3T+RWUo0OR8YP3kl 8YYmJgYmxsZmxsbmJuakCSuJ8z6SXxouJJCeWJKanZpakFoEs4WJg1OqgXGP5jPmf+85nnDb VGfZN6ip+tqxJ9qs3MNuX2r0xeiLeJVM85ISyeSNoTqz+p4az7Uu5zFd03OI6VtqaEj5Himf 7vd9BaqJBSaPj0ybVVbix5ocKaYnLbTl4Q0Pv387twR8it2h+Mdq/+TZngmcjFf1NLV/hr6f KGlSPTfYrPrd0Sfx/vGsSizFGYmGWsxFxYkAktGq0ZUCAAA= Subject: Re: [MdeModulePkg] SetVirtualAddressMap() crashed due to DxeReportStatusCodeLib assuming the state of the BootService Memory at runtime. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2016 02:07:17 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII > On Aug 8, 2016, at 6:21 PM, Zeng, Star wrote: > > Andrew, > > Should MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib be used for your case if there are really runtime status code reporting needed? > Star, If the Library instance does not fully support DXE_RUNTIME_DRIVER, why is it listed in the LIBRARY_CLASS as supported? https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf#L25 LIBRARY_CLASS = ReportStatusCodeLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE Actually I tried to add the UefiRuntimeDriverLib and the build failed as UefiRuntimeDriverLib was not supported for the DXE_CORE type. Maybe the bug is this library instance lists DXE_RUNTIME_DRIVER, DXE_SAL_DRIVER and DXE_SMM_DRIVER when it has special case code to support DXE_CORE? Maybe this library is trying to do too many things? What ReportStatusCodeLib would you recommend to link with RuntimeDxe driver: https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf Thanks, Andrew Fish > Thanks, > Star > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andrew Fish > Sent: Tuesday, August 9, 2016 7:08 AM > To: edk2-devel > Subject: [edk2] [MdeModulePkg] SetVirtualAddressMap() crashed due to DxeReportStatusCodeLib assuming the state of the BootService Memory at runtime. > > I was messing about with an ExitBootServices test that fills boot services memory with 0xAFAFAFAFAFAFAFAF (It was Vincent's idea to use my Initials but it has the handy property of being a non-cononical address and causes on GP fault on X64) and SetVirtualAddressMap() started crashing. > > It looks like this code is assuming the 1st call to ReportStatus code will not happen at runtime. This is not the case for the RuntimeDxe driver. > https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c#L43 > VOID > InternalGetReportStatusCode ( > VOID > ) > { > EFI_STATUS Status; > > if (mReportStatusCodeLibStatusCodeProtocol != NULL) { > return; > } > > // > // Check gBS just in case ReportStatusCode is called before gBS is initialized. > // > if (gBS != NULL && gBS->LocateProtocol != NULL) { > Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**) &mReportStatusCodeLibStatusCodeProtocol); > if (EFI_ERROR (Status)) { > mReportStatusCodeLibStatusCodeProtocol = NULL; > } > } > } > > I'm guessing this seems to work due to:https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c#L803 > > // > // Zero out the Boot Service Table > // > ZeroMem (gBS, sizeof (EFI_BOOT_SERVICES)); > > > Thus if I'm looking at this code correctly it only looks like it works at Runtime since it is depending on the value of a boot services memory buffer not changing. This is not a valid assumption as that code is owned by the caller of ExitBootServices, so it should be legal for my test to change the value. > > I wanted to get a few more eyes on this prior to filling a bug? > > Thanks, > > Andrew Fish > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel