30781 Commits

Author SHA1 Message Date
Savva Mitrofanov
7f5dbfa5f9
MdeModulePkg/DebugSupportDxe: Corrects MSVC build
Fixes 6c974ab21e212c1867c871f989f6f1df5786e99e by supressing type cast
warning for MSVC

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-18 16:19:36 +06:00
Savva Mitrofanov
763413cc8c
.github/workflows: Use efibuild.sh instead of stuart pytools for CodeQL
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-18 16:19:35 +06:00
Savva Mitrofanov
58f816c0db
.github/workflows: Adds nested udk package warning workaround for CodeQL 2023-01-17 22:12:41 +06:00
Savva Mitrofanov
60f85a3683
.pytool: Drop OpenCorePkg from supported pkg list for stuart
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-17 21:42:27 +06:00
Savva Mitrofanov
648c4f33cc
OvmfPkg/OvmfPkgIa32X64: Increase PEIFV size
The NOOPT build target produces greater overall size of PEI modules than available inside firmware volume, which leads to GenFv invalid size
error

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-17 20:59:29 +06:00
Savva Mitrofanov
40b67dcb57
.pytool: Add OpenCorePkg package into stuart_build CISetting.py
This commit corrects CodeQL workflow by adding missing submodule
OpenCorePkg for BaseTools

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-17 20:59:21 +06:00
Savva Mitrofanov
f335cf23f1
Revert "Ext4Pkg: Add comparison between Position and FileSize in Ext4SetPosition"
This reverts commit f21c8083753d667815d2719a9e7417dd4f1277c5.
We don't need to perform this check in SetPosition because by spec this
check done in read operation

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-01-13 12:57:46 +03:00
vit9696
8b6e67bcd9 Ext4Pkg: Filter out file names containing \0 as invalid
This patch improves checks added in 74135485.

Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
2023-01-12 13:31:47 +03:00
vit9696
6349385d72 OpenCorePkg: Sync with upstream for the new PCD 2023-01-04 21:57:56 +03:00
Vitaly Cheptsov
39d0ce7013 MdePkg: Add PCD to remove X perm from image sections with WX perms
This feature is useful for images created by old Apple mtoc utility.

Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
2023-01-04 20:03:26 +03:00
Mikhail Krichanov
1ddbcf7ccf Build: Updated OpenCore submodule to current master branch. 2022-12-29 11:03:38 +03:00
Savva Mitrofanov
122531754a
UefiPayloadPkg/UefiPayloadEntry: Fixes universal payload build
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-29 00:19:53 +06:00
Mikhail Krichanov
cf92e9f7d7 BaseTools: Replaced GenFw with ImageTool and MicroTool. 2022-12-28 17:21:20 +03:00
Mikhail Krichanov
ef68b89fbc SecurePE: Replaced old PE loader with Secure one. 2022-12-28 17:08:53 +03:00
Savva Mitrofanov
f625249b1e
MdeModulePkg/CapsuleApp: Add missing EFIAPI modifier in CapsuleDump
Fixes calling conventions by defining CompareFileNameInAlphabet with
ms_abi

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-28 13:12:09 +06:00
Savva Mitrofanov
6c974ab21e
MdeModulePkg/DebugSupportDxe: Adds callback function prototypes in
caller

Adds EFI_EXCEPTION_CALLBACK and EFI_PERIODIC_CALLBACK casts to
RegisteredCallback call in InterruptDistributionHub to suppress
deprecated non-prototype LLVM 15 warning

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-28 13:12:03 +06:00
Savva Mitrofanov
d9a6e6736c
MdeModulePkg/CapsuleOnDiskLoadPei: Removes unused Index variable
Removes unused Index local variable in RetrieveRelocatedCapsule to
suppress compiler warning in LLVM 15

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-28 13:11:52 +06:00
Savva Mitrofanov
a0e8bd78ac
NetworkPkg/WifiConnectionManagerDxe: Removes unused variable
Removes unused variable in WifiMgrRefreshNetworkList routine to correct
build

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-26 17:44:35 +06:00
Savva Mitrofanov
a6d2c4b981
CryptoPkg/BaseCryptLib: Removes unused variable in CryptX509
Removes unused local variable in X509ConstructCertificateStackV

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-26 17:44:18 +06:00
Savva Mitrofanov
25ce5524c9
MdeModulePkg/RegularExpressionDxe: Corrects onigurama build with LLVM 15
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-26 16:37:58 +06:00
Savva Mitrofanov
2b7d183551
MdeModulePkg/VarCheckHiiLib: Remove unused variable FfsIndex
Corrects compiler warning due to unused variable in VarCheckHiiGenFromFv

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-26 16:34:27 +06:00
Marvin Häuser
acac38949d BaseTools/tools_def: Disable PIE generation for IA32 CLANGDWARF
Commit c25d390 disabled PIE generation for GCC49 and GCC5 as the GCC toolchains
at the time started enabling it by default. LLVM 15 has now done the same thing
for all Linux targets [1]. This causes the emission of a GOT with relocations
that GenFw does not currently support.

As such, disable PIC and PIE for the CLANGDWARF toolchain for IA32 targets, as
already done for GCC49 and GCC5, to support LLVM 15.

[1] ca68038d12

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2022-12-24 17:14:25 +01:00
Savva Mitrofanov
849db11550
CryptoPkg/OpensslLib: Fix build for XCODE5 compiler on macOS
REF: https://edk2.groups.io/g/devel/message/88179

Add missing corrections for 504558b4ef29d6637df05a31a07ec67711e71544.
A build of CryptoPkg with XCODE5 on macOS is now trying to include
Availability.h, which isn't found. Seems the problem is in condition
logic inside openssl/include/crypto/rand.h

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-23 22:53:27 +06:00
Savva Mitrofanov
a18c196866
MdeModulePkg/SmbiosMeasurementDxe: Removes unused local variable
Removes unused local variable Size in GetSmbiosStringById

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-23 22:53:26 +06:00
Savva Mitrofanov
bc19befe04
MdeModulePkg/BrotliCustomDecompressLib: Correct BrotliDecompress
We need to pass DestSize as pointer, because we assign this output var
to TotalOut value inside BrotliDecompress routine

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-23 22:53:25 +06:00
Savva Mitrofanov
19528eb6ec
.gitignore: Add compile_flags.txt
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-23 22:53:24 +06:00
Marvin Häuser
6e4e45eb38 MdePkg/PerformanceLib: Fix "unused-but-set-variable" warning
The current definitions of PERF_CODE_BEGIN() and PERF_CODE_END() use the local
variable __PerformanceCodeLocal as an attempt to track parity. If
PERF_CODE_END() is used without a preceding PERF_CODE_BEGIN(),
__PerformanceCodeLocal will not have been declared and a compilation error will
be issued. The mutations of the variable are not used to track nesting or such.
As the value of this variable is never actually used, recent Clang versions
issue a "unused-but-set-variable" warning for it.

To solve this, re-define __PerformanceCodeLocal as a BOOLEAN that is always
FALSE and use it in a do-while loop condition as done explicitly in many places.
Like the previous solution, PERF_CODE_END() cannot be used without
PERF_CODE_BEGIN(), as __PerformanceCodeLocal will be not have been defined.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2022-12-23 15:21:02 +01:00
Marvin Häuser
4f19426aec MdePkg/DebugLib: Fix "unused-but-set-variable" warning
The current definitions of DEBUG_CODE_BEGIN() and DEBUG_CODE_END() use the local
variable __DebugCodeLocal as an attempt to track parity. If DEBUG_CODE_END() is
used without a preceding DEBUG_CODE_BEGIN(), __DebugCodeLocal will not have been
declared and a compilation error will be issued. The mutations of the variable
are not used to track nesting or such. As the value of this variable is never
actually used, recent Clang versions issue a "unused-but-set-variable" warning
for it.

To solve this, re-define __DebugCodeLocal as a BOOLEAN that is always FALSE and
use it in a do-while loop condition as done explicitly in many places. Like the
previous solution, DEBUG_CODE_END() cannot be used without DEBUG_CODE_BEGIN(),
as __DebugCodeLocal will be not have been defined.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2022-12-23 15:20:20 +01:00
Mikhail Krichanov
76b839a71f Build: Previous fix update. 2022-12-21 12:45:25 +03:00
Mikhail Krichanov
aea03cb7b9 Build: Fixed missing HII for X64, IA32 CLANGDWARF DEBUG, NOOPT. 2022-12-21 12:35:26 +03:00
Mikhail Krichanov
075bf6c35e
MdePkg/X64/ProcessorBind.h: Fixes CLANGDWARF X64 compilation
Corrects typedef redefinition, in particular for openssl e_os2.h

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-14 16:51:08 +06:00
Savva Mitrofanov
57f8489c5a
OvmfPkg/PlatformInitLib: Corrects initializers to fix NOOPT build
Fixes OvmfPkg build using XCODE5, CLANGPDB and CLANGDWARF toolchains
for NOOPT target

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-14 16:29:41 +06:00
Savva Mitrofanov
dc249ba42d
UefiCpuPkg/CpuExceptionHandlerLib: Increase mBuffer size
Add missing GDT alignment into mBuffer to prevent possible memory
corruption on ALIGN_POINTER operation on NewGdtTable
in ArchExceptionHandler

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-09 16:46:50 +06:00
Savva Mitrofanov
e1008d1947
Revert "UefiCpuPkg: Enhance logic in InitializeMpExceptionStackSwitchHandlers"
This reverts commit 4b7bd4c591a81a290b31e9d1a94c4b8be787989e, because it
breaks IA32 targets, at least for XCODE5, CLANGPDB and CLANGDWARF
toolchains

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-08 22:09:25 +06:00
Savva Mitrofanov
63a36f173c
OvmfPkg/PlatformInitLib: Fix unused variable warning in IntelTdx
This workaround should avoid unused variable warning on
AccumulateAcceptedMemory counter

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-08 22:07:13 +06:00
Savva Mitrofanov
9ceeed0935
CryptoPkg/OpensslLib: Fix build for XCODE5 compiler on macOS
REF: https://edk2.groups.io/g/devel/message/88179

A build of CryptoPkg with XCODE5 on macOS is now trying to include
Availability.h, which isn't found. Seems the problem is in condition
logic inside openssl/include/crypto/rand.h

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-08 22:07:12 +06:00
Savva Mitrofanov
504558b4ef
Ext4Pkg: Add missing exit Status in Ext4OpenDirent
Missing EFI_OUT_OF_RESOURCES exit status on failed Ext4CreateDentry
leads to NULL-pointer dereference in Ext4GetFileInfo (passing NULL
buffer in Ext4ReadDir)

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-08 22:07:11 +06:00
Savva Mitrofanov
b4077c6f4f
Ext4Pkg: Check VolumeName allocation correctness in Ext4GetVolumeName
Missing check in some cases leads to failed StrCpyS call in
Ext4GetVolumeLabelInfo. Also correct condition that checks Inode pointer
for being NULL in Ext4AllocateInode

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-08 22:07:10 +06:00
Savva Mitrofanov
8f4875d7b5
Ext4Pkg: Check that source file is directory in Ext4OpenInternal
This check already present in the while loop below, but absent for cases
when input file is nameless, so to handle assertion in Ext4ReadFile we
need to add it at the top of function

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:07 +06:00
Savva Mitrofanov
515a55fec3
Ext4Pkg: Correct integer overflow check on multiplication in DiskUtil
Multiplication overflow could result into small numbers, so we need also
check it

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:06 +06:00
Savva Mitrofanov
ed668ba596
Ext4Pkg: Fix shift out of bounds in Ext4OpenSuperblock
Missing check for wrong s_log_block_size exponent leads to shift out of
bounds. Limit block size to 2 MiB

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:05 +06:00
Savva Mitrofanov
17fa176e4d
Ext4Pkg: Add inode number validity check
We need to validate inode number to prevent possible null-pointer
dereference of directory parent in Ext4OpenDirent. Also checks that
inode number valid across opened partition before we read it in
Ext4ReadInode.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:04 +06:00
Savva Mitrofanov
f21c808375
Ext4Pkg: Add comparison between Position and FileSize in Ext4SetPosition
Missing such comparison leads to infinite loop states, for example code
which trying to read entire file can easily get out of bound of
file size by passing position value which exceeds file size without this
check. So we need to add there missing comparison between the desired
position to be set and file size

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:03 +06:00
Savva Mitrofanov
bc05eacaa3
Ext4Pkg: Fix division by zero by adding check for s_inodes_per_group
Superblock s_inodes_per_group field can't be zero, it leads to division
by zero in BlockGroup routine Ext4ReadInode

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:02 +06:00
Savva Mitrofanov
2d406aacfb
Ext4Pkg: Fix incorrect checksum metadata feature check
Missing comparison != 0 leads to broken logic condition. Also replaced
CSUM_SEED feature_incompat check with predefined macro EXT4_HAS_INCOMPAT

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:01 +06:00
Savva Mitrofanov
7413548584
Ext4Pkg: Fix global buffer overflow in Ext4ReadDir
Directory entry structure can contain name_len bigger than size of "."
or "..", that's why CompareMem in such cases leads to global buffer
overflow. So there are two problems. The first is that statement doesn't
check cases when name_len != 0 but > 2 and the second is that we passing
big Length to CompareMem routine.
The correct way here is to check that name_len <= 2 and check for
null-terminator presence

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:00 +06:00
Savva Mitrofanov
fbb8595120
Ext4Pkg: Move EXT4_NAME_MAX definition to Ext4Disk.h
Constant EXT4_NAME_MAX is related to EXT4_DIR_ENTRY FS structure, so it
should be placed into Ext4Disk.h header

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:47:59 +06:00
Savva Mitrofanov
0c1c5a6ce1
Ext4Pkg: Fix memory leak in Ext4RetrieveDirent
We need to free buffer on return if BlockRemainder != 0. Also changed
return logic from function to use use common exit to prevent code
duplication.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:47:58 +06:00
Savva Mitrofanov
7da674d1c9
RedfishPkg/BaseUcs2Utf8Lib: Fix out of bounds shift in UTF8ToUCS2Char
Missing masks leads to shift out of bounds. Also there is no need to
construct CHAR16 using cast to CHAR8 buffer, better to use native endian
by assigning data directly into Ucs2Char variable

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
2022-12-07 14:47:57 +06:00
Savva Mitrofanov
340c5bc2f4
MdePkg/BasePcdLibNull: Remove ASSERT from LibPcdGetSize, LibPcdGetExSize
GetSize routines should return zero size when checking Token existence

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
2022-12-07 14:47:56 +06:00