ArmTrng.c: In function 'GenerateEntropy':
ArmTrng.c:40:15: error: 'Status' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
EFI_STATUS Status;
^~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
NvmExpressMediaSanitize.c: In function 'NvmExpressMediaClear':
NvmExpressMediaSanitize.c:337:29: error: 'Status' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
EFI_STATUS Status;
^~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Handle.c:1302:24: error: 'Prot' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
*Interface = Prot->Interface;
~~~~^~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Dispatcher.c:1639:34: error: 'FvMigrationFlags' may be used uninitialized
in this function [-Werror=maybe-uninitialized]
(((FvMigrationFlags & FLAGS_FV_MIGRATE_BEFORE_PEI_CORE_REENTRY) == 0) ||
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
1.HttpResponseWorker(DEADCODE)
The result of pointer arithmetic "HttpHeaders+AsciiStrLen("HTTP/1.1") + 1"
is never null.
2.HttpsSupport.c (NULL_RETURNS)
NetbufAlloc might return null pointer ,so assigning "NULL" to
"PacketOut" and "DataOut" pointer.
Solution:
1.Removed the NULL Check for "StatusCodeStr"
2.Added Null Check for PacketOut and returned EFI_OUT_OF_RESOURCES
on NULL case.
Signed-off-by: santhosh kumar V <santhoshkumarv@ami.com>
This patch addresses an issue in the FMMT operations where the parent
reference is not checked for NoneType. This oversight can lead to an
AttributeError: 'NoneType' object has no attribute 'Name' when
attempting to access the parent reference. The fix involves adding a
check for NoneType before accessing the parent reference to ensure that
the operations handle such cases gracefully.
The affected functions include:
- AddNewFfs
- ReplaceFfs
- ExtractFfs
These functions now include proper checks to prevent the AttributeError.
Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
The specification wasn't clear and even contradict itself regarding
the calculation of the disk size. This have been clarified by Xen
commit 221f2748e8da ("blkif: reconcile protocol specification with
in-use implementations").
https://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=221f2748e8dabe8361b8cdfcffbeab9102c4c899
The value from the xenstore node "sectors" must be multiplied by 512
to have the size of the disk.
Calculation of LastBlock is now the same for both CD-ROM case and
generic case.
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
PeiCoreBuildHobHandoffInfoTable() always returns EFI_SUCCESS, and also
its return is not consumed at all, so this patch removes return for
PeiCoreBuildHobHandoffInfoTable().
Signed-off-by: Star Zeng <star.zeng@intel.com>
SafeIntLib has been added to UnitTestFrameworkPkg Common Includes DSC
for usage in host and target based tests.
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
RelocDir->Size is a UINT32 value, and RelocDir->VirtualAddress is
also a UINT32 value. The current code in
PeCoffLoaderRelocateImageForRuntime does not check for overflow when
adding RelocDir->Size to RelocDir->VirtualAddress. This patch uses
SafeIntLib to ensure that the addition does not overflow.
Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
After commit aca75d3 the PayloadEntry ELF header will miss dynamic
section which caused PEI_ASSERT in PayloadLoader rebasing code.
This commit adding common-page-size=0x1000 to CLANGDWARF_DLINK_FLAGS
to overcome the ELF header generation issue.
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
There is already `PRINT_HII (STRING_TOKEN (STR_GEN_CRLF), NULL);`
after `DownloadFile()`, remove this extra `\n` to avoid
printing extra blank lines.
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
Commit 459f5ffa24 ("OvmfPkg/QemuKernelLoaderFsDxe: rework direct
kernel boot filesystem") has a small change in behavior: In case
there is no data the file is not created and attempts to open file
return EFI_NOT_FOUND. Old behavior was to add a zero-length file
to the filesystem.
Fix GenericQemuLoadImageLib to handle EFI_NOT_FOUND correctly for
'initrd' and 'cmdline'.
Reported-by: Srikanth Aithal <sraithal@amd.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Commit d64d1e195c ("MdeModulePkg: PeiMain: Introduce implementation
of delayed dispatch") introduced a new usage of the TimerLib which
uses a dynamic PCD in OvmfXen platform. But PeiMain has only access to
a NULL version of PcdLib, so OvmfXen can't start.
Introduce PeiPcdLib for PEI_CORE so PeiMain can read dynamic PCDs.
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
Adds a library to generate the ACPI FACS table for X64 architecture.
It gathers the necessary FACS information from the configuration manager.
Additionally, it includes an event to update the hardware signature
in the FACS table, where the hardware signature is the
CRC of all ACPI table's CRC
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
QEMU enables VIRTIO_VGA by default.
Libvirt falls back from virtio-gpu-pci to virtio-vga if made available by
QEMU.
We need to enable VGA support to get video output for EDK II in
virt-manager.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Remove myself from reviewer role for below folders:
MdeModulePkg: Universal Payload definitions
MdePkg
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
The magic page is allocated from a fixed address specified
by PcdPeiServicesTablePage. This allocation has been observed
to sometimes fail. Move the allocation of this buffer to the
very beginning of main() to minimize the change that another
allocation is allocated from the PcdPeiServicesTablePage
address.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Manageability status code is introduced to edk2. Enable the ability
to report Redfish communication failure via status code. This
gives the chance for BMC to capture Redfish error.
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Today VS2022 and GCC are set to treat all compiler warnings as
errors and break the build. However, linker warnings for both
do not break the build. There are critical errors that can be
treated as warnings as the linker, such as not finding the
module entry point and use a default address as the entry
point. This will cause a runtime crash for something that
should be caught at build time.
This commit adds /WX to VS2022's DLINK_FLAGS and --fatal-warnings
to GCC's DLINK_FLAGS for IA32, X64, ARM, and AARCH64 in order to
break the build on linker warnings.
VS2022 linker warning 4210 is ignored for all builds because it
checks for static initializers and the linking of the VCRuntime.
edk2 never links the VCRuntime (except for HOST_APPLICATIONs) and
so the presence of static initializers will always cause this
warning, even when the edk2 code calls these initializers that
would otherwise be called in the _CRT_INIT function of the
VCRuntime. At the time of this commit, it only fails in CryptoPkg
for building OpenSSL, but could fail anywhere a static initializer
is used.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
IA32 EmulatorPkg had many linker warnings because with the current
set of linker flags, the MSVC linker was expecting the __stdcall
calling convention on all entry points. This was an effect of
having /SUBSYSTEM:CONSOLE on all binaries built in EmulatorPkg; this
is only needed on WinHost, as that is what Windows launches. The linker
options are adjusted to only set /SUBSYSTEM:CONSOLE on WinHost.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Remove IA32 from supported architectures, as the MSVC build actually
fails due to the linker expecting a __stdcall calling convention.
IA32 PRMs are not supported anyway, only 64 bit OSes support PRM,
so simply drop the building of IA32 PrmPkg and clarify the README.
While there, clean up some markdown errors.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Added LoongArch64 CPU multiple processor PPI support.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
CpuMpPei.c contains two parts: EFI_PEI_MP_SERVICES_PPI instance and
CpuMpPpi list installer. Move the EFI_PEI_MP_SERVICES_PPI instance in a
new file called CpuMp.c, keep the specific logic and entry point in
CpuMpPei.c, and rename the CpuMp2Pei.c to CpuMp2.c
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Restructured the SmmWaitForApArrival first CPU synchronization
conditional checks and added new IsCpuSyncAlwaysNeeded check to determine
whether the sync should be executed unconditionally when a SMI occurs.
The first CPU synchronization shall executed unconditionally if the new
IsCpuSyncAlwaysNeeded check return TRUE. Otherwise, first CPU
synchronization is not executed unconditionally, and the decision to
synchronize should be based on the system configuration and status.
Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
The Visual Studio Windows debugger will only load symbols for PE/COFF images
that Windows is aware of. Therefore, to enable source level debugging, all
PEI/DXE modules must be loaded via LoadLibrary() or LoadLibraryEx() and the
the instance in memory created by LoadLibrary() must be the one that is
actually executed.
The current source level debug implementation in EmulatorPkg for Windows is
inherited from the old Nt32Pkg. This implementation makes the assumption that
all PEI/DXE modules have a DLL export tables with a symbol named
InitializeDriver. Therefore, this source level debug implementation requires
all modules to be linked in a non-PI spec defined manner. Support for adding
the InitializeDriver symbol was removed in EmulatorPkg, which broke source
level debugging.
To fix this, the source level debugging implementation has been modified to
use the PE/COFF entry point directly. This brings the implementation into
compliance with the PI spec and should work with any PEIM/DXE driver.
Implementing this requires parsing the in-memory instance of the PE/COFF image
created by Windows to find the entrypoint and since PEIMs/DXE drivers are not
garunteed to have 4KB aligned sections, it also requires explicit configuration
of the page table using VirtualProtect().
With this fix, the debugging experience is now so good it is unprecedented!
In Visual Studio Code, add the following to launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "EmulatorPkg Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/<path_to_build>/Build/EmulatorX64/DEBUG_<tool_chain>/X64/WinHost",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/<path_to_build>/Build/EmulatorX64/DEBUG_<tool_chain>/X64/",
"environment": [],
"console": false,
}
]
}
Make modifications to the above template as nessesary and build EmulatorPkg.
Now, just add breakpoints directly in Visual Studio Code the way you would with
any other software project. When you start the debugger, it will halt at the
breakpoint automatically without any extra configuration required.
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
There are two reserved FAT entries in the FAT filesystem that
are expected to have valid contents in them. Today the FAT drivers
do not validate these entries when reading from a device for the
first time. This can cause infinite loops in the FAT driver when
trying to read corrupted disks as reported in
https://github.com/tianocore/edk2/issues/9679.
This PR follows the recommended update requested in that bug to
check the two reserved FAT entries and validate their contents
against the spec defined values in both FatPei and EnhancedFatDxe
when opening a device for the first time.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Add the 'opt/org.tianocore/EnableLegacyLoader' FwCfg option to
enable/disable the insecure legacy linux kernel loader.
For now this is enabled by default. Probably the default will be
flipped to disabled at some point in the future.
Also print a warning to the screen in case the linux kernel secure
boot verification has failed.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Try load shim first. In case that succeeded update the command line to
list 'kernel' first so shim will fetch the kernel from the kernel loader
file system.
This allows to use direct kernel boot with distro kernels and secure
boot enabled. Usually distro kernels can only be verified by distro
shim using the distro keys compiled into the shim binary.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Try load shim first. In case that succeeded update the command line to
list 'kernel' first so shim will fetch the kernel from the kernel loader
file system.
This allows to use direct kernel boot with distro kernels and secure
boot enabled. Usually distro kernels can only be verified by distro
shim using the distro keys compiled into the shim binary.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Allows to use the qemu kernel loader pseudo file system for other
purposes than loading a linux kernel (or efi binary). Passing
startup.nsh for EFI shell is one example.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Triggers when trying to get root directory info.
Reproducer:
* Use qemu -kernel with something edk2 can not load.
* When dropped into the efi shell try inspect the file system.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
QEMU_FW_CFG_FNAME_SIZE is 56. 'etc/boot/' prefix is minus 9. Add one
for the terminating '\0'. Effective max size is 48.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Split KERNEL_BLOB struct into two:
* One (KERNEL_BLOB_ITEMS) static array describing how to load (unnamed)
blobs from fw_cfg.
* And one (KERNEL_BLOB) dynamically allocated linked list carrying the
data blobs for the pseudo filesystem.
Also add some debug logging. Prefix most functions with 'QemuKernel'
for consistency and easier log file grepping. Add some small helper
functions.
This refactoring prepares for loading blobs in other ways.
No (intentional) change in filesystem protocol behavior.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
The environment variable `GTEST_CATCH_EXCEPTION` must be
set to `0` for so all exceptions are handled by the
address sanitizer and not GoogleTest. This allows stack
back trace and other details to be logged by the address
sanitizer so the source of the issue identified address
sanitizer can be determined.
The environment variable `ASAN_OPTIONS` must be set to
`detect_leaks=0` to disable memory leak detection. The
unit test frameworks may have memory leaks and some
firmware code under test use cases may perform a memory
allocation without a matching memory free as their
expected behavior.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Add HostMemoryAllocationBelowAddressLib class and implementation that
uses OS specific services to perform pool and page allocations below
a specified address in a host based unit test application execution
environment. This library class is only required for mocking buffers
that are assumed to be below a specific address by code under test.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>