From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 861E8D80F93 for ; Mon, 30 Oct 2023 07:49:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=P9FuCUt6UToA9MFGnSRwTPGhYlGjfOQDtwf/yW5e8tQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698652175; v=1; b=usnOxSK0nsl6GJSWuxZlhebdqokXCjgn+6d7ow9UyOO8U/Sm2Ki7Tw0uTfZwvm2IPE/gDqmk WATGtjymUXOP+jlQl7m1t7Mkzc8xLIroeTXn5iBU+t9KIMyDEZgPZ4fxcQ5WxbQnntTmAabQVmK tF47Yt9anyOeDDdu49saCEU8= X-Received: by 127.0.0.2 with SMTP id nZyQYY7687511xexbc8MsCYo; Mon, 30 Oct 2023 00:49:35 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.143793.1698652164261209974 for ; Mon, 30 Oct 2023 00:49:34 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="419138584" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="419138584" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 00:49:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="736666762" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="736666762" X-Received: from shpfwdbuild003.ccr.corp.intel.com ([10.239.56.82]) by orsmga006.jf.intel.com with ESMTP; 30 Oct 2023 00:49:32 -0700 From: "Xu, Wei6" To: devel@edk2.groups.io Cc: Wei6 Xu , Laszlo Ersek , Ard Biesheuvel , Sami Mujawar , Ray Ni Subject: [edk2-devel] [PATCH v3 3/4] StandaloneMmPkg/Core: Fix issue that section address might be wrong Date: Mon, 30 Oct 2023 15:49:17 +0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,wei6.xu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: xRWtVfjI19gRckWeE0KPVnr6x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=usnOxSK0; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) MmCoreFfsFindMmDriver() assumes FileHeader is EFI_FFS_FILE_HEADER. If FileHeader is an EFI_FFS_FILE_HEADER2, 'FileHeader + 1' will get a wrong section address. Use FfsFindSection to get the section directly, instead of 'FileHeader + 1' to avoid this issue. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Ray Ni Signed-off-by: Wei6 Xu --- StandaloneMmPkg/Core/FwVol.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c index 9d0ce66ef839..fa335d62c252 100644 --- a/StandaloneMmPkg/Core/FwVol.c +++ b/StandaloneMmPkg/Core/FwVol.c @@ -116,23 +116,21 @@ MmCoreFfsFindMmDriver ( break;=0D }=0D =0D - Status =3D FfsFindSectionData (=0D + Status =3D FfsFindSection (=0D EFI_SECTION_GUID_DEFINED,=0D FileHeader,=0D - &SectionData,=0D - &SectionDataSize=0D + &Section=0D );=0D if (EFI_ERROR (Status)) {=0D break;=0D }=0D =0D - Section =3D (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);=0D - Status =3D ExtractGuidedSectionGetInfo (=0D - Section,=0D - &DstBufferSize,=0D - &ScratchBufferSize,=0D - &SectionAttribute=0D - );=0D + Status =3D ExtractGuidedSectionGetInfo (=0D + Section,=0D + &DstBufferSize,=0D + &ScratchBufferSize,=0D + &SectionAttribute=0D + );=0D if (EFI_ERROR (Status)) {=0D break;=0D }=0D --=20 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110299): https://edk2.groups.io/g/devel/message/110299 Mute This Topic: https://groups.io/mt/102270548/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-