summaryrefslogtreecommitdiff
path: root/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
AgeCommit message (Collapse)AuthorFilesLines
2023-02-08Ext4Pkg: Add inode number validity checkSavva Mitrofanov1-2/+11
We need to validate inode number to prevent reading non-existent and incorrect inodes so we checks that inode number valid across opened partition before we read it in Ext4ReadInode. Cc: Marvin Häuser <mhaeuser@posteo.de> Cc: Pedro Falcato <pedro.falcato@gmail.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.") Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com> Acked-by: Marvin Häuser <mhaeuser@posteo.de>
2023-01-26Ext4Pkg: Add documentation surrounding ext4 directory entriesPedro Falcato1-2/+19
Several questions have popped up regarding the ext4 directory entry layout and contents off-list. Attempt to clarify these issues by adding some explanatory comments. Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Cc: Marvin Häuser <mhaeuser@posteo.de> Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
2022-09-15Ext4Pkg: Add symbolic links supportSavva Mitrofanov1-6/+7
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3677 Provided support for symlink file type. Added routine which allows reading and following them through recursive open() call. As a security meausure implemented simple symlink loop check with nest level limit equal 8. Also this patch moves Ext4Open functionality to internal routine. Cc: Marvin Häuser <mhaeuser@posteo.de> Cc: Pedro Falcato <pedro.falcato@gmail.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com> Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
2022-08-07Ext4Pkg: Code correctness and security improvementsSavva Mitrofanov1-1/+2
This changes tends to improve security of code sections by fixing integer overflows, missing alignment checks, unsafe casts, also simplified some routines, fixed compiler warnings and corrected some code mistakes. - Set HoleLen to UINT64 to prevent truncation in Ext4Read function - Replace EXT4_BLOCK_NR with 32-bit EXT2_BLOCK_NR in BlockMap, because by specification files using block maps must be placed within the first 2^32 blocks of a filesystem - Replace UNREACHABLE with ASSERT (FALSE) in case of new checksum algorithms, due to it is an invariant violation rather than unreachable path - Solve compiler warnings. Initialize all fields in gExt4BindingProtocol Fix comparison of integer expressions of different signedness - Field name_len has type CHAR8, while filename limit is 255 (EXT4_NAME_MAX), so because structure EXT4_DIR_ENTRY would be unchangeable in future, we could drop this check without any assertions - Simplify Ext4RemoveDentry logic by using IsNodeInList - Fix possible int overflow in Ext4ExtentsMapKeyCompare - Return bad block type in Ext4GetBlockpath - Adds 4-byte aligned check for superblock group descriptor size field Cc: Marvin Häuser <mhaeuser@posteo.de> Cc: Pedro Falcato <pedro.falcato@gmail.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com> Reviewed-by: Marvin Häuser <mhaeuser@posteo.de> Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
2022-06-14Ext4Pkg: Add ext2/3 supportPedro Falcato1-0/+2
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3745 Adds ext2/3 support by supporting (legacy) block maps. Also fixes a bug regarding uninitialised extents. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-06-14Ext4Pkg: Format using uncrustifyPedro Falcato1-11/+17
Previously, Ext4Pkg was formatted using uncrustify with an older config file. Re-format it using the upstream edk2 uncrustify config file. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-12-01Ext4Pkg: Add uninitialized extents supportPedro Falcato1-0/+8
Uninitialized extents are special extents that have blocks allocated, but are specified as uninitialized and therefore, reads behave the same as file holes (reads 0), while writes already have blocks allocated. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-08-24Ext4Pkg: Add a directory entry tree.Pedro Falcato1-0/+3
This helps us track directories and directory entries, which helps us getting a general idea of how the filesystem looks. In the future, it might serve as a directory cache. Right now, it only lets us know which name "." and ".." may refer to, which fixes a EFI_FILE_PROTOCOL::GetInfo() bug that got triggered by ShellPkg, in some MdePkg code. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2021-08-19Ext4Pkg: Add Ext4Dxe driver.Pedro Falcato1-0/+454
Adds a UEFI EXT4 filesystem driver that implements the EFI_FILE_PROTOCOL and EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2021-08-19Revert "Ext4Pkg: Add Ext4Dxe driver." to correct AuthorMichael D Kinney1-454/+0
This reverts commit ac10729d2c9482aff7c37545c8d84d38b685c1d9. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2021-08-18Ext4Pkg: Add Ext4Dxe driver.devel@edk2.groups.io1-0/+454
Adds a UEFI EXT4 filesystem driver that implements the EFI_FILE_PROTOCOL and EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>