On Wed, Aug 25, 2021 at 03:31:52PM +0200, Erwan Velu wrote: > Commit 8b1e5d1936fffc490510e85c95f93248453586c1 introduced the support > of bigtime by adding the some features in inodes V3. > > This change extended grub_xfs_inode struct by 76 bytes but also changed the > computation of XFS_V3_INODE_SIZE & XFS_V2_INODE_SIZE. > > Prior this commit, XFS_V2_INODE_SIZE was 100 bytes, after the commit it's 84 > bytes. > XFS_V2_INODE_SIZE becomes 16 bytes too small. > > As a result, the data structure aren't properly aligned and generates > "attempt to read or write outside of partition" errors when trying to > read the filesystem. > > GNU GRUB version 2.11 > .... > grub> set debug=efi,gpt,xfs > grub> insmod part_gpt > grub> ls (hd0,gpt1)/ > partmap/gpt.c:93: Read a valid GPT header > partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 > fs/xfs.c:931: Reading sb > fs/xfs.c:270: Validating superblock > fs/xfs.c:295: XFS v4 superblock detected > fs/xfs.c:962: Reading root ino 128 > fs/xfs.c:515: Reading inode (128) - 64, 0 > fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, > 3840 > error: attempt to read or write outside of partition. > > This commit change the XFS_V2_INODE_SIZE computation by substracting 76 > instead of 92 from the actual size of grub_xfs_inode. > This 76 value is coming from the added : > 20 uint8 unused5 > 1 uint64 flags2 > 48 uint8 unused6 > > This patch explicit the split between the v2 and v3 parts of structure. > The unused4 is still ending to the v2 structures and the v3 starts at unused5. > This will avoid future corruption of v2 or v3. > > The XFS_V2_INODE_SIZE is returning to its expected size and the > filesystem is back to a readable state. > > GNU GRUB version 2.11 > .... > grub> set debug=efi,gpt,xfs > grub> insmod part_gpt > grub> ls (hd0,gpt1)/ > partmap/gpt.c:93: Read a valid GPT header > partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 > fs/xfs.c:931: Reading sb > fs/xfs.c:270: Validating superblock > fs/xfs.c:295: XFS v4 superblock detected > fs/xfs.c:962: Reading root ino 128 > fs/xfs.c:515: Reading inode (128) - 64, 0 > fs/xfs.c:515: Reading inode (128) - 64, 0 > fs/xfs.c:931: Reading sb > fs/xfs.c:270: Validating superblock > fs/xfs.c:295: XFS v4 superblock detected > fs/xfs.c:962: Reading root ino 128 > fs/xfs.c:515: Reading inode (128) - 64, 0 > fs/xfs.c:515: Reading inode (128) - 64, 0 > fs/xfs.c:515: Reading inode (128) - 64, 0 > fs/xfs.c:515: Reading inode (131) - 64, 768 > efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0 > grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024 > grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816 > grub> > > Signed-off-by: Erwan Velu <e.v...@criteo.com>
Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com> Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel