From patchwork Mon Mar 20 20:45:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 95582 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1129153qgd; Mon, 20 Mar 2017 13:45:24 -0700 (PDT) X-Received: by 10.98.7.203 with SMTP id 72mr34529742pfh.197.1490042724194; Mon, 20 Mar 2017 13:45:24 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id w2si18725694pgo.389.2017.03.20.13.45.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 13:45:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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) 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) 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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/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 ( ImageAddress = LoadedImage->ImageBase; - PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress); - if (PdbPointer != NULL) { - DEBUG ((DEBUG_VERBOSE, " Image - %a\n", PdbPointer)); + PdbPointer = NULL; + if (ImageAddress != 0) { + PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress); + if (PdbPointer != NULL) { + DEBUG ((DEBUG_VERBOSE, " Image - %a\n", PdbPointer)); + } } //