From nobody Sun May 5 14:50:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 14900427253511003.2194293080275; Mon, 20 Mar 2017 13:45:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6678E8046C; Mon, 20 Mar 2017 13:45:23 -0700 (PDT) Received: from mail-wr0-x229.google.com (mail-wr0-x229.google.com [IPv6:2a00:1450:400c:c0c::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5658980466 for ; Mon, 20 Mar 2017 13:45:22 -0700 (PDT) Received: by mail-wr0-x229.google.com with SMTP id l37so100338756wrc.1 for ; Mon, 20 Mar 2017 13:45:22 -0700 (PDT) Received: from localhost.localdomain (189.17.90.92.rev.sfr.net. [92.90.17.189]) by smtp.gmail.com with ESMTPSA id y6sm22078349wrc.40.2017.03.20.13.45.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 13:45:20 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WCULkoNN8RgfmCFV/lJr97l4tzx+QoGXUC3WA3VUJHM=; b=hOeQCnSHBmid4kncjTAMOanzrsiyoZ352wV85nK+qwnSYWJtsy6ySyyDrtktwMM4rT 0Isr+Q5FGIuWCRZ2hiMaFd5x5xjBmKx+ACCAQFwmcJVtp+SNxslMKuhqaSyE3C58qbUy AgCuS2zEexmcrZ9h6dcREmGNF0Tntn+NKcy7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WCULkoNN8RgfmCFV/lJr97l4tzx+QoGXUC3WA3VUJHM=; b=q7fKep7GAiY5MR5LvyodwCkzNkbj6Ph0lHbERG71CRDtBN/nVqnBfmCdaEJtBu0vDF pqKYrYRgRHhu0RYnpN0LN1juIuvDntxhrYldw8uuJGgTwNFXgT189NYxcg9Gt8oB1rLO 1DIND5jr54QMH4uUm54RsLY44uJ3sEi29a6XnM68k4NsxKXZoS2jnhs0wBQec9hmBELb eiSsOPelaVk7vJai4RzeZ7saMgktrz+Y7XUug0WdCEb2CHaIrytBcBzIiHKQzgJOzHvY 5Map1l56F4Wjw4cMb3ocuvRzs6jg3bM1Cu05Ev72Hqxgh4OVYOr2GkQWmmyZlT1E85fz mHdw== X-Gm-Message-State: AFeK/H1gZW/eSgE4jgk8FHtSYUFt1FvgQKoOVk/q8mObKm9Bf/liKOkwscen5Y7Dwq0hD92p X-Received: by 10.223.138.134 with SMTP id y6mr27117351wry.118.1490042720950; Mon, 20 Mar 2017 13:45:20 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, jiewen.yao@Intel.com Date: Mon, 20 Mar 2017 20:45:03 +0000 Message-Id: <1490042703-19896-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdeModulePkg/DxeCore: ignore PdbPointer if ImageAddress == 0 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: , Cc: feng.tian@Intel.com, star.zeng@intel.com, Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The memory protection code may be invoked to unprotect a driver when DxeCore has not completed loading yet, in which case ImageAddress may still be zero. So ignore the PdbPointer in this case, to prevent PeCoffLoaderGetPdbPointer() from ASSERT()ing on a NULL value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/C= ore/Dxe/Misc/MemoryProtection.c index 7689c794a8ad..6ecbb311a8c3 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c @@ -462,9 +462,12 @@ ProtectUefiImageCommon ( =20 ImageAddress =3D LoadedImage->ImageBase; =20 - PdbPointer =3D PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress); - if (PdbPointer !=3D NULL) { - DEBUG ((DEBUG_VERBOSE, " Image - %a\n", PdbPointer)); + PdbPointer =3D NULL; + if (ImageAddress !=3D 0) { + PdbPointer =3D PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress= ); + if (PdbPointer !=3D NULL) { + DEBUG ((DEBUG_VERBOSE, " Image - %a\n", PdbPointer)); + } } =20 // --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel