From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: star.zeng@intel.com, feng.tian@Intel.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Mon, 20 Mar 2017 20:45:22 -0000 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/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)); + } } // -- 2.7.4