From nobody Sat May 18 21:00:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90276+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90276+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1654580107; cv=none; d=zohomail.com; s=zohoarc; b=DYXI3U0JmMLVtk2uWhcBuU4jxGPuFDEjjLKfAIZguijgENXarG13OT7Mw0yx7ek82/eVEHBJ5HUjE9iXu3oCpy3r2l7QNvl712Hn78wGuTdwQUGXYQlAQoY3nj2bHQ6jkn6zVuo+u9HIYQzvJZ6QkYg709IsDfe/K1GIghrc5QQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654580107; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=1tCycjxJs8LhbOEQJyzqZchRmgQ4gFX6k2F0f9BGmaw=; b=AFuRa8ffJhAfNrM0DrIETtxSSpFwDCn4huvDivn96+lKtJdQchkC0R5TWI3S3zLldILDEk6cgRn6EvU31uOpgWPw6WvGrOX7Qapt3V6v8hKkL70qZkNzRWEnt4KS1Dchb5oxjxrDUTfAAVnpugEnwSeKT3k68LbO7amjrCS81Qc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90276+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1654580107284963.426672248985; Mon, 6 Jun 2022 22:35:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id uzrqYY1788612xMpHWVaO6dS; Mon, 06 Jun 2022 22:35:06 -0700 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.8456.1654580104709086507 for ; Mon, 06 Jun 2022 22:35:05 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="257151064" X-IronPort-AV: E=Sophos;i="5.91,282,1647327600"; d="scan'208";a="257151064" X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 22:35:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,282,1647327600"; d="scan'208";a="826201261" X-Received: from linjaso1-desk1.gar.corp.intel.com ([10.5.215.41]) by fmsmga006.fm.intel.com with ESMTP; 06 Jun 2022 22:35:01 -0700 From: "Lin, Jason1" To: devel@edk2.groups.io Cc: Jason1 Lin , Bob Feng , Liming Gao , Yuwei Chen , Dakota Chiang , Vanessa Chuang Subject: [edk2-devel] [PATCH v2] [edk2-platforms] Silicon/Intel/FitGen: Fix CheckOverlap would do incorrect split BiosModule action in corner case Date: Tue, 7 Jun 2022 13:34:55 +0800 Message-Id: <20220607053455.5015-1-jason1.lin@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,jason1.lin@intel.com X-Gm-Message-State: TdIjGFVw5C1xc0ogxCAWtLVlx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654580106; bh=O4kYu5kzOVsg/0py5/Imo072TZ0RA6BPFE7Q+NXGqKU=; h=Cc:Date:From:Reply-To:Subject:To; b=o9E4l32TiEd8sg6Hhyu2xZYKPrP6b7xIt+KDwMQW7iAmppvWGQ7v5prv/j/yIUcXRES ci6BoJp/TaJGtPmnifdXVia9vaLsVMLU/6j6NIe7JnkcTHREWiTTRrAyEkTCf9nz1vlI1 ExEVZgec9XhDJGxKmuqiMBAiUIjrWxBJzEY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654580108212100001 Content-Type: text/plain; charset="utf-8" From: Jason1 Lin REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3922 [Description] CheckOverlap function would do incorrect split on the BiosModule which not happen overlap. This would cause incorrect value locate in FIT entry record. [Condition] - This BiosModule base address is lower than input address. - This BiosModule size is smaller than input size. [Resolution] - Do the check on BiosModule size and input size value to prevent possible nagative value. Signed-off-by: Jason1 Lin Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Cc: Dakota Chiang Cc: Vanessa Chuang --- Silicon/Intel/Tools/FitGen/FitGen.c | 31 +++++++++++++++++++- Silicon/Intel/Tools/FitGen/FitGen.h | 4 +-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 290e688f6e..0cdba56a48 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -2,7 +2,7 @@ This utility is part of build process for IA32/X64 FD. It generates FIT table. =20 -Copyright (c) 2010-2021, Intel Corporation. All rights reserved.
+Copyright (c) 2010-2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -755,11 +755,40 @@ CheckOverlap ( IN UINT32 Address, IN UINT32 Size ) +/*++ +Routine Description: + + Check wheather the input address and size is overlap with any BiosModule. + If happen overlap, need to be deal with this case. + --- +--------------+ <------ BiosModule A Base +-----= ---------+ + | | | | = | + | | | Bio= sModule | + | | | = A | + | | | = | + BiosModule A +--------------+ <------ [Input] Address =3D=3D=3D=3D> = +--------------+ + Size | | | + | | | [Input] Size + +--------------+ ------ +-----= ---------+ + | | | Bio= sModule | + | | | | = B | + --- +--------------+ +-----= ---------+ + +Arguments: + + Address - The address of the buffer that required to check. + Size - The size of the buffer that required to check. + +Returns: + + None + +--*/ { INTN Index; =20 for (Index =3D 0; Index < (INTN)gFitTableContext.BiosModuleNumber; Index= ++) { if ((gFitTableContext.BiosModule[Index].Address <=3D Address) && + (gFitTableContext.BiosModule[Index].Size >=3D Size) && ((gFitTableContext.BiosModule[Index].Size - Size) >=3D (Address - = gFitTableContext.BiosModule[Index].Address))) { UINT32 TempSize; INT32 SubIndex; diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 5add6a8870..b7de0a6b2d 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -1,7 +1,7 @@ /**@file Definitions for the FitGen utility. =20 -Copyright (c) 2010-2020, Intel Corporation. All rights reserved.
+Copyright (c) 2010-2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information // #define UTILITY_MAJOR_VERSION 0 -#define UTILITY_MINOR_VERSION 64 +#define UTILITY_MINOR_VERSION 65 #define UTILITY_DATE __DATE__ =20 // --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90276): https://edk2.groups.io/g/devel/message/90276 Mute This Topic: https://groups.io/mt/91594865/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-