Add badge rows for the Windows CLANGPDB, Ubuntu CLANGPDB, and Ubuntu
CLANGDWARF toolchains in the Core CI and Platform CI sections.
Remove stale IA32 badge entries for EmulatorPkg and OvmfPkg.
Reorganize Platform CI into per-toolchain sections for clarity.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
A purge erase operation on NVMe devices using the MediaSanitize
(MediaPurge) protocol fails with Status Code 02h (Invalid Field
in Command).
According to NVMe specification revision 1.4c, the Sanitize
command (OpCode 84h) does not use the NSID field (Section 5,
Figure 142). For commands that do not use NSID, the field must
be cleared to 0 as defined in Section 4.2, Figure 106.
Clear NSID to 0 before issuing the Sanitize command to ensure
spec compliance and prevent command failure.
Signed-off-by: Shabab Alam <shabalam@qti.qualcomm.com>
Currently, CLANGPDB X64 has 4KB section alignment and unwind
tables. CLANGDWARF has neither.
4KB section alignment is up for review in a separate PR, so this
commit adds unwind tables to DEBUG/NOOPT, matching both CLANGPDB
and other toolchains.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Currently, the CLANGDWARF definitions for AARCH64 and RISCV64
(which was copied from the AARCH64 definitions originally) don't
follow the same pattern as CLANGDWARF IA32/X64 and the rest of
tools_def.template. This makes it harder to read and easier to
make an error (e.g. other toolchain define cc/dlink flags in
debug, release, noopt order, they do it in debug, noopt, release
order, so it would be easy to swap flags intended for release and
noopt).
This is a whitespace and comment only change, no flags are changed.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access
RootCause: FileSize and FileLength are declared as
UINT32 and masked with 0x00FFFFFF to store only the lower 24 bits.
Although this approach yields the correct result,
it introduces a potential risk due to unsafe typecasting and
dereferencing.
Solution: Using the predefined macro FFS_FILE_SIZE()
from MdePkg\Include\Pi\PiFirmwareFile.h,
which safely performs the same operation by reconstructing
the size using individual byte access.
This commit also addresses the fix for coverity isssue "OVERRUN"
Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access
RootCause: FileSize, FileLength and SectionLength are declared as
UINT32 and masked with 0x00FFFFFF to store only the lower 24 bits.
Although this approach yields the correct result,
it introduces a potential risk due to unsafe typecasting and
dereferencing.
Solution: Using the predefined macro FFS_FILE_SIZE()
and SECTION_SIZE from MdePkg\Include\Pi\PiFirmwareFile.h,
which safely performs the same operation by reconstructing
the size using individual byte access.
This commit also addresses the fix for coverity issue "OVERRUN"
Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
For a well-formed Dependency Expression, the code should
never get here. The BEFORE and AFTER are processed prior to
this routine's invocation. If the code flow arrives at this point,
present code only called ASSERT(FALSE),
causing release builds to fall through to the EFI_DEP_SOR case.
Adding an explicit return FALSE after the assertion ensures
correct error handling in release and debug build modes.
This commit also addresses the fix for Coverity
issue "MISSING BREAK"
Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
- Correct header underline lengths to meet ReStructuredText standards.
- Standardize path separators to forward slashes for consistency.
- Fix grammar and improve phrasing in the Submodules section.
Signed-off-by: Phineas Su <pohaosu@google.com>
Fix CLANGDWARF OBJCOPY errors for AARCH64 and RISCV64 by
setting OBJCOPY_FLAGS to an empty string so OBJCOPY actions
do not generate an error. This matches the IA32 and X64
settings for CLANGDWARF OBJCOPY_FLAGS.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Clear DLINK_XIPFLAGS to disable use of alignment flags
for all tool chains. Setting alignment flags other than
the OS application defaults are not required for
EmulatorPkg builds.
Add and/or clarify comments to explain the overrides to
the default firmware build configurations required for
EmulatorPkg.dsc builds.
Align Mingw CLANGDWARF to GCC by moving the application
libraries into DLINK2_FLAGS.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
CLANGPDB build of EmulatorPkg is supported on Windows, but not Linux.
In order to complete CLANGPDB CI, introduce an Azure pipelines file to
run this build. The file is a duplicate of current Windows-VS.yml in the
same directory simply with the toolchain changed, similar to the approach
taken in recent commits to add Ubuntu CLANGDWARF and CLANGPDB CI.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Just require PcdRequireSelfSignedPk=FALSE instead of using CustomMode to
enroll PK keys which are not self-signed.
PcdRequireSelfSignedPk=FALSE is the default configuration for OVMF since
commit 3c01a11daa ("OvmfPkg: set PcdRequireSelfSignedPk to FALSE").
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Currently, there is a bug in UpdateRegionMappingRecursive() when
guard pages are enabled and a large page is being split.
The code checks whether the page table is a block or table and
seeing that it is a block, allocates a new page table for the next
level. However, when it does this, it will call an additional recursive
call into the page table updating logic to make sure the new page table
page is mapped. In addition, when guard pages are enabled, it will
mark the guard page as RP. If the guard page is in the same block as
we are already trying to split, the recursive call will split the
block and mark the guard page as RP.
When we return to the original call, it will fill out the now
orphaned page table but never install it into the page table
hierarchy (and if it did, it would lose the guard page). This
has been observed to cause a driver's code section to still have
NX set on it and so crash when trying to execute.
This commit resolves the issue by checking if the block has
already been split when we return from the new page table
allocation. If it has, we simply update the existing table mapping
instead of trying to split the block.
The allocated page table page cannot be immediately freed, because
this might trigger the block to get re-merged, so a reference to
it is held until the end of updating this level and subsequent
levels, when it can be safely freed. It is possible that the mapping
extends across two large pages and this issue could exist on both
sides, so in the worst case we may have two orphaned tables to
free.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
When TpmLib is built with llvm, below error is splat:
edk2/TcgTpmPkg/Library/TpmLib/TPM/TPMCmd/tpm/src/crypt/CryptRand.c:388:12: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses]
388 | if(DRBG_ENCRYPT_SETUP((BYTE*)key, DRBG_KEY_SIZE_BITS, &localKeySchedule) != 0)
To build TCG TPM v2.0 reference library properly, ignore above warning.
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Update NASM files to use NASM file extensions.
Also update VTF0 Python scripts to Python 3.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Flatten the following functions to make them easier to read:
- TraverseHandleDatabase()
- GetDeviceHandleInfo()
- DoDecodeByProtocol()
No functional change.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long function present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long function present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long function present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
AmdSevX64.dsc has several build options, but DEBUG_TO_MEM is
missing from the top definition list. This makes it difficult
for users to identify all available configuration flags.
Add DEBUG_TO_MEM to the [Defines] section with a default value of
FALSE to improve visibility.
This change has no functional change.
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
MicrovmX64.dsc has several build options, but DEBUG_TO_MEM is
missing from the top definition list. This makes it difficult
for users to identify all available configuration flags.
Add DEBUG_TO_MEM to the [Defines] section with a default value of
FALSE to improve visibility.
This change has no functional change.
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
OvmfPkgIa32X64.dsc has several build options, but DEBUG_TO_MEM is
missing from the top definition list. This makes it difficult
for users to identify all available configuration flags.
Add DEBUG_TO_MEM to the [Defines] section with a default value of
FALSE to improve visibility.
This change has no functional change.
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
Remove post-parse write to mHestIA32HardwareBankCount.
Keep HEST parsing read-only.
*mHestIA32HardwareBankCount = 0, line in code corrupts the
ACPI HEST table data Hardware bank count to zero.
mHestIA32HardwareBankCount points into the parsed HEST table
data (input buffer). Writing through it modifies ACPI table
contents during parsing, which should be read-only behavior.
Signed-off-by: Gaurav Pandya <Gaurav.Pandya@amd.com>
ANTLR 4.9 is broken in python 3.13 because
it uses a library in the autogenerated files
that is removed.
This updates to 4.13.2 and also updates the autogen
files, which contain support for python 3.13 as well
as backwards compat.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
The ANTLR autogen files are currently created
without an SPDX identifer. Add the BSD-2-Clause-Patent
ID.
While here, correct the command to do the autogeneration
by using the right filename.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
If OVMF is built with PcdRequireSelfSignedPk=FALSE we do not need
CustomMode to enroll an unsigned platform key (PK).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
AuthVariableLib behavior wrt VendorKeys changes depending on
PcdRequireSelfSignedPk state. Given this is not security critical
just skip the VendorKeys check in EnrollDefaultKeys
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
If OVMF is built with PcdRequireSelfSignedPk=FALSE it is possible to
enroll an unsigned platform key (PK) without depending on CustomMode for
that.
Update EnrollDefaultKeys accordingly. If setting CustomMode fails do
not consider that a fatal error. Print a warning instead. Also update
Settings.CustomMode only in case CustomMode has been enabled
successfully, so we can use that later on to check whenever CustomMode
must be disabled or not.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Recent UEFI spec versions do not require a self-signed PK any more.
There is no good reason for OVMF to stick to this requirement, but
there is one reason to remove it: It is not needed to enable
CustomMode then to enroll secure boot keys which are not self-signed.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Exclude these ranges in addition to the ranges from the static
mPreValidatedRange array, by checking the IGVM data HOBs in
DetectPreValidatedOverLap().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
The current OvmfPkg only page aligns sections of DXE runtime and SMM
images for image protections. However, image protections are applied
to other image types like DXE_DRIVER, DXE_CORE, UEFI_DRIVERS and
UEFI_APPLICATION which makes those images unprotected.
This change applies page alignment to sections of image DXE_DRIVER,
DXE_CORE, UEFI_DRIVER and UEFI_APPLICATION so image protections take
effect.
!!!!!!!! Image Section Alignment(0x40) does not match Required Alignment (0x1000) !!!!!!!!
ProtectUefiImage failed to create image properties record
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
In order to facilitate management, move FirmwarePerformancePei driver
to PEI driver region. In this case, all PEI drivers are together.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Cc: Zixing Liu <liushuyu@aosc.io>
This change adds dependent libraries and drivers to LoongArch OVMF
package to enable firmware performance support.
Signed-off-by: Zixing Liu <liushuyu@aosc.io>
In DXE_RUNTIME_DRIVER and UEFI_DRIVER, ExtractGuidedSectionLib should
use DxeExtractGuidedSectionLib.inf instead of
PeiExtractGuidedSectionLib.inf.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Add RsaPssSignDigest() and RsaPssVerifyDigest() to BaseCryptLib for
signing/verifying precomputed digests. Provide OpenSSL/MbedTLS/Null
implementations, expose via EDKII_CRYPTO_PROTOCOL (v24), and add PCD
controls for independent service enabling. Include unit tests.
Signed-off-by: Anbazhagan Baraneedharan <anbazhagan@hp.com>
Given the start method of FFA is only introduced in revision 5 of the TCG
ACPI specification. A TPM2 table with FFA start method and lower than 5
revision should not be allowed.
This change updates the checks for revision PCD and removed a few
conditions based on new revision 5 assumptions.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
Current Tcg2AcpiFfa will populate the partition ID in byte order of big-
endian. This conflicts with the TCG ACPI Specification, which specifies
the byte-order to be little-endian.
This change corrects the byte order population process by replacing the
platform parameter byte array with MdePkg defined structure.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
Current implementation of Tcg2AcpiFfa does not rely on the interfaces
defined in `Tcg2PhysicalPresenceLib`. Carrying it in the module inf could
bring in unnecessary external dependencies and cause loading orders to
change.
This change removes the dependency from the current "LibraryClasses"
list.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
Delete a few debug messages when searching x-uefi string.
This reduces the messages when DEBUG_MANAGEABILITY is
enabled.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Install EDKII_HTTP_CALLBACK_PROTOCOL in HttpBootDxe to receive TLS
events from HttpDxe during the HTTP Boot process. When a TLS error
occurs (failed TLS session connection or TLS configuration), print an
error message on screen using AsciiPrint().
The callback is installed in HttpBootInstallCallback() and uninstalled
in HttpBootUninstallCallback(), ensuring TLS errors are only printed
during the HTTP Boot process and not for other TLS accesses.
Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
LinuxGccToolChain is checking for the environment variable
GCC_AARCH64_PREFIX when GCC_AARCH64_INSTALL is set in the environment
variables. GCC_AARCH64_INSTALL is set when any gcc aarch64 compiler
is installed (i.e. aarch64-none-elf, aarch64-linux-gnu, aarch64-unknown-elf
all result in a GCC_AARCH64_INSTALL environment variable).
When compiling for an X86 target, if an AARCH64 tool chain is installed
in the system, this will result in an error due to the GCC_AARCH64_PREFIX
not being set.
Add a check based upon TARGET_ARCH and and only verify the prefixes
when attempting to build AARCH64.
Replicate the same check for RISCV and LOONGARCH64 architectures as well.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
Some guests (e.g. kvmtool) do not provide a SMMU, so the PCI node
in the DTB lacks an 'iommu-map'. The current code ASSERTs during
boot with:
"ASSERT [ConfigurationManagerDxe] RootComplexParser.c(244):
(Data != ((void *) 0)) && ((DataSize % (4 * sizeof (UINT32))) == 0)"
Instead, return EFI_NOT_FOUND when 'iommu-map' is absent so firmware
boot can proceed.
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
When the Kvmtool guest is launched without ITS support
i.e. when --irq-chip=gicv3-its option is not specified
or if --irq-chip=gicv3 is specified, the guest VM does
not have an ITS.
In such scenarios the guest firmware must not install
the IORT table. Therefore, add checks to see if ITS is
present before installing the IORT ACPI table.
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>