From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id E1ED8AC12B6 for ; Wed, 31 Jul 2024 17:10:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=7YeqmeIcILv3GYVHaS57DukwlYiTTiw6kbTTS1hmfTA=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:Message-ID:Date:MIME-Version:User-Agent:Subject:To:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1722445821; v=1; b=Au9dx2v/7IrPmMhawWgsJbI91fauPZs9AyhJVp3eRfA0l8K6rywwnvj7th01hqmCTly29GFf xr9Q3++Mdl4FZDZTRACHNQOY+G6AcYVWoC3k2Pp+zADTP0KmKkQJaRp92q5jVAo7/OOVJGu7IXV nWyVtLcH6T7I6wrDIlrJqBlbfs2Wa5uLo5m+fiv5tBjIoz7EZ1d+ycV2acFuWhorFsrwjLfZDBf i9xgIXG+mwc6O9XTfmwnLp3wst6LpekNIuB6JlWDk2SWLQYHyiGTU6NiUjqsbV2Z1dydXxYt8Sf jcgQu0sCQxc5rJ1mYjY5VVvypM1db2I1RJQURyq7VWohw== X-Received: by 127.0.0.2 with SMTP id UvZ3YY7687511xpc4P5Z3NBw; Wed, 31 Jul 2024 10:10:20 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.48381.1722445819795654667 for ; Wed, 31 Jul 2024 10:10:19 -0700 X-Received: from [10.137.194.171] (unknown [131.107.159.43]) by linux.microsoft.com (Postfix) with ESMTPSA id 308F120B7165; Wed, 31 Jul 2024 10:10:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 308F120B7165 Message-ID: <00c586e4-fd53-4c86-b64d-cb8e26e7c147@linux.microsoft.com> Date: Wed, 31 Jul 2024 10:10:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] Unable to build OvmfPkgX64.dsc with VS2022 ("PE image Section-Alignment and File-Alignment do not match") To: devel@edk2.groups.io, rebecca@bsdio.com, Matthew Carlson References: <26155a79-7a3f-4b2b-9106-ea30ff9941d4@bsdio.com> From: "Oliver Smith-Denny" In-Reply-To: <26155a79-7a3f-4b2b-9106-ea30ff9941d4@bsdio.com> 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 Resent-Date: Wed, 31 Jul 2024 10:10:19 -0700 Resent-From: osde@linux.microsoft.com Reply-To: devel@edk2.groups.io,osde@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JN41lozeTXcYbO0BIpzR1Hy4x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="Au9dx2v/"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io On 7/30/2024 9:50 PM, Rebecca Cran wrote: > There appears to be a problem with the newly-added VS2022 toolchain. I=20 > only just installed Windows after not using it for quite a while so I=20 > don't know if it's user error, but I get the following failure with=20 > "build -p OvmfPkg\OvmfPkgX64.dsc -a X64 -b RELEASE -t VS2022". Building= =20 > with VS2019 works. >=20 > I have VS2022 version 17.10.5 installed. >=20 >=20 > Generating PEIFV FV > ##### ['GenFv', '-a',=20 > 'd:\\src\\tiano\\edk2\\Build\\OvmfX64\\RELEASE_VS2022\\FV\\Ffs\\PEIFV.inf= ', '-o', 'd:\\src\\tiano\\edk2\\Build\\OvmfX64\\RELEASE_VS2022\\FV\\PEIFV.F= v', '-i', 'd:\\src\\tiano\\edk2\\Build\\OvmfX64\\RELEASE_VS2022\\FV\\PEIFV.= inf'] > Return Value =3D 2 > GenFv: ERROR 3000: Invalid > =C2=A0 PE image Section-Alignment and File-Alignment do not match :=20 > d:\src\tiano\edk2\Build\OvmfX64\RELEASE_VS2022\FV\Ffs\52C05B14-0B98-496c-= BC3B-04B50211D680PeiCore\52C05B14-0B98-496c-BC3B-04B50211D680.ffs. > GenFv: ERROR 3000: Invalid > =C2=A0 Could not rebase=20 > d:\src\tiano\edk2\Build\OvmfX64\RELEASE_VS2022\FV\Ffs\52C05B14-0B98-496c-= BC3B-04B50211D680PeiCore\52C05B14-0B98-496c-BC3B-04B50211D680.ffs. >=20 > Not sure if it matters, but since I guess it might be fairly uncommon,=20 > I'm building on a ReFS volume on Windows Server 2022. >=20 >=20 Hi Rebecca, You are seeing that because VS2022 has /ALIGN:4096 set and VS2019 does not. VS2022 has the correct behavior here, we need 4k alignment for memory protections (see upcoming PRs that will bring Project Mu memory protection work to edk2, including updating the section alignment). What you are seeing is a very old GenFv bug: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1124. This has been worked around by putting XIP modules in a separate FV than non-XIP modules and setting FvForceRebase to False (or using compressed FVs) for non-XIP modules. The problem is that GenFv only has the ability to force rebase or not for an entire FV, not per module. Really we would need to have an XIP marker that would tell GenFv how to rebase per module. XIP modules are required to have file alignment match section alignment and GenFv extends this to every module in the same FV as an XIP module. Until this bug is fixed, Ovmf will have to set FvForceRebase=3DFalse on non-XIP module FVs and split XIP modules into their own FV. But, without 4k section alignment we don't have image memory protections. Thanks, Oliver -=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 (#120156): https://edk2.groups.io/g/devel/message/120156 Mute This Topic: https://groups.io/mt/107641140/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-