From nobody Mon Dec 23 13:26:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 1516846741438172.50049222974894; Wed, 24 Jan 2018 18:19:01 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D3A1321D2BEE8; Wed, 24 Jan 2018 18:13:30 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DA7AE21E256B7 for ; Wed, 24 Jan 2018 18:13:29 -0800 (PST) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 18:18:58 -0800 Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.10]) by orsmga006.jf.intel.com with ESMTP; 24 Jan 2018 18:18:57 -0800 X-Original-To: edk2-devel@lists.01.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; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,409,1511856000"; d="scan'208";a="13283921" From: Hao Wu To: edk2-devel@lists.01.org Date: Thu, 25 Jan 2018 10:18:49 +0800 Message-Id: <20180125021849.4572-1-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 Subject: [edk2] [PATCH] IntelSiliconPkg/MicrocodeUpdateDxe: Refine debug messages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Jiewen Yao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Refine the debug messages during the verification of microcode to make them more clear. Cc: Jiewen Yao Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- .../Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c | 21 +++++++++++++++--= ---- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUp= date.c b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate= .c index b99221c969..6167e0b584 100644 --- a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c +++ b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c @@ -8,7 +8,7 @@ =20 MicrocodeWrite() and VerifyMicrocode() will receive untrusted input and = do basic validation. =20 - Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -437,7 +437,7 @@ VerifyMicrocode ( return EFI_VOLUME_CORRUPTED; } if (TotalSize !=3D ImageSize) { - DEBUG((DEBUG_ERROR, "VerifyMicrocode - fail on TotalSize\n")); + DEBUG((DEBUG_ERROR, "VerifyMicrocode - TotalSize not equal to ImageSiz= e\n")); *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT; if (AbortReason !=3D NULL) { *AbortReason =3D AllocateCopyPool(sizeof(L"InvalidTotalSize"), L"Inv= alidTotalSize"); @@ -496,16 +496,25 @@ VerifyMicrocode ( // if ((ExtendedTableLength > sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADE= R)) && ((ExtendedTableLength & 0x3) =3D=3D 0)) { CheckSum32 =3D CalculateSum32((UINT32 *)ExtendedTableHeader, Exten= dedTableLength); - if (CheckSum32 =3D=3D 0) { + if (CheckSum32 !=3D 0) { + // + // Checksum incorrect + // + DEBUG((DEBUG_ERROR, "VerifyMicrocode - The extended checksum is = incorrect\n")); + } else { // // Checksum correct // ExtendedTableCount =3D ExtendedTableHeader->ExtendedSignatureCou= nt; - if (ExtendedTableCount <=3D (ExtendedTableLength - sizeof(CPU_MI= CROCODE_EXTENDED_TABLE_HEADER)) / sizeof(CPU_MICROCODE_EXTENDED_TABLE)) { + if (ExtendedTableCount > (ExtendedTableLength - sizeof(CPU_MICRO= CODE_EXTENDED_TABLE_HEADER)) / sizeof(CPU_MICROCODE_EXTENDED_TABLE)) { + DEBUG((DEBUG_ERROR, "VerifyMicrocode - ExtendedTableCount too = big\n")); + } else { ExtendedTable =3D (CPU_MICROCODE_EXTENDED_TABLE *)(ExtendedTab= leHeader + 1); for (Index =3D 0; Index < ExtendedTableCount; Index++) { CheckSum32 =3D CalculateSum32((UINT32 *)ExtendedTable, sizeo= f(CPU_MICROCODE_EXTENDED_TABLE)); - if (CheckSum32 =3D=3D 0) { + if (CheckSum32 !=3D 0) { + DEBUG((DEBUG_ERROR, "VerifyMicrocode - Checksum is incorre= ct for ExtendedTable with index 0x%x\n", Index)); + } else { // // Verify Header // @@ -526,7 +535,7 @@ VerifyMicrocode ( } if (!CorrectMicrocode) { if (TryLoad) { - DEBUG((DEBUG_ERROR, "VerifyMicrocode - fail on CurrentProcessorSig= nature/ProcessorFlags\n")); + DEBUG((DEBUG_ERROR, "VerifyMicrocode - fail on Current ProcessorSi= gnature/ProcessorFlags\n")); } *LastAttemptStatus =3D LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION; if (AbortReason !=3D NULL) { --=20 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel