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>
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>
Removes unused Index local variable in RetrieveRelocatedCapsule to
suppress compiler warning in LLVM 15
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>