On 7/30/2024 9:50 PM, Rebecca Cran wrote:
There appears to be a problem with the newly-added VS2022 toolchain. I only just installed Windows after not using it for quite a while so I don't know if it's user error, but I get the following failure with "build -p OvmfPkg\OvmfPkgX64.dsc -a X64 -b RELEASE -t VS2022". Building with VS2019 works.

I have VS2022 version 17.10.5 installed.


Generating PEIFV FV
##### ['GenFv', '-a', 'd:\\src\\tiano\\edk2\\Build\\OvmfX64\\RELEASE_VS2022\\FV\\Ffs\\PEIFV.inf', '-o', 'd:\\src\\tiano\\edk2\\Build\\OvmfX64\\RELEASE_VS2022\\FV\\PEIFV.Fv', '-i', 'd:\\src\\tiano\\edk2\\Build\\OvmfX64\\RELEASE_VS2022\\FV\\PEIFV.inf']
Return Value = 2
GenFv: ERROR 3000: Invalid
  PE image Section-Alignment and File-Alignment do not match : 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
  Could not rebase d:\src\tiano\edk2\Build\OvmfX64\RELEASE_VS2022\FV\Ffs\52C05B14-0B98-496c-BC3B-04B50211D680PeiCore\52C05B14-0B98-496c-BC3B-04B50211D680.ffs.

Not sure if it matters, but since I guess it might be fairly uncommon, I'm building on a ReFS volume on Windows Server 2022.



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=1124. 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=False 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


-=-=-=-=-=-=-=-=-=-=-=-
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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to