slimbootloader/PayloadPkg
Stanley Chang b6f150c0ea [ExtLib] fix invalid memory access to support large EXT fs (#1739)
This patch fixes an invalid memory access issue caused by
the fs->Ext2FsGDSize is smaller than the size of EXT2GD.

The EXT2GD is a 64-byte structure, but fs->Ext2FsGDSize is not always 32.

Before this patch, Ext2fsOpen() allocates a smaller memory than expected:
  i.e., Ext2FsGrpDes = AllocatePool (Ext2FsGDSize * Ext2FsNumCylinder);
When ReadGDBlock() loads data (E2FS_CGLOAD) into fs->Ext2FsGrpDes,
it possibly accesses mem out of the allocated Ext2FsGrpDes space.

This patch loads each element into fs->Ext2FsGrpDes.

This patch also
1. prints informative messages when OS Loader fails to load Linux files.
2. increase EHL's PLD_HEAP_SIZE (since the size of initrd in Ubuntu LiveCD
   is over 130MB)

Test method:
1. create a huge EXT FS (says, at least 36GB)
2. In the fs, place the following file/dir:
    a: non-empty file
    b: dir
    b/c: non-empty file
3. boot with SBL OS Loader and enter Shell.
4. execute "fs init <...skip...>" to init the fs
5. execute "fs ls"
6. execute "fs ls b/c"
7. execute "fs load a"
8. execute "fs load b/c"

Verify:
1. 10MB/10GB/100GB/200GB EXT2/EXT3/EXT4 FS
2. EHL CRB

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2022-11-14 08:33:16 -07:00
..
CsmeUpdateDriver Use LF line endings in the repository 2021-11-10 12:46:42 -08:00
FirmwareUpdate Add check on uCode total size during uCode update 2022-11-04 15:00:05 -07:00
HelloWorld HelloWorld: Use ConsolePrint to simplify code and fix GCC build 2022-01-13 08:09:25 -08:00
Include Add MP service for payload 2022-03-02 09:04:08 -08:00
Library [Common] Fix Osloader hang when HAVE_ACPI_TABLE=0 2022-08-31 16:25:53 -07:00
OsLoader [ExtLib] fix invalid memory access to support large EXT fs (#1739) 2022-11-14 08:33:16 -07:00
PayloadPkg.dec Add a PCD to set RTCM RSVD SIZE 2021-11-15 19:05:05 -08:00
PayloadPkg.dsc Fix HelloWorld payload build issue 2022-01-12 07:50:06 -08:00