Skip to contentSkip to conversation

fs/xfs: Avoid unreadble filesystem if V4 superblock

PATCH In review Erwan Velu 5 participants 23 messages Aug 25, 2021 – Sep 14, 2021

lore
Share & tools
lore

Erwan Velu

author
#0 lore raw

PATCH 1/1 fs/xfs: Avoid unreadble filesystem if V4 superblock

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>
---
 grub-core/fs/xfs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
grub-core/fs/xfs.c +6 -4
index 0f524c3a8a61..becea5bcdf61 100644
@@ -192,6 +192,7 @@ struct grub_xfs_time_legacy
   grub_uint32_t nanosec;
 } GRUB_PACKED;
 
+// From https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf about 'struct xfs_dinode_core'
 struct grub_xfs_inode
 {
   grub_uint8_t magic[2];
@@ -208,14 +209,15 @@ struct grub_xfs_inode
   grub_uint32_t nextents;
   grub_uint16_t unused3;
   grub_uint8_t fork_offset;
-  grub_uint8_t unused4[37];
+  grub_uint8_t unused4[17]; // Last member of inode v2
+  grub_uint8_t unused5[20]; // First member of inode v3
   grub_uint64_t flags2;
-  grub_uint8_t unused5[48];
+  grub_uint8_t unused6[48]; // Last member of inode v3
 } GRUB_PACKED;
 
 #define XFS_V3_INODE_SIZE	sizeof(struct grub_xfs_inode)
-/* Size of struct grub_xfs_inode until fork_offset (included). */
-#define XFS_V2_INODE_SIZE	(XFS_V3_INODE_SIZE - 92)
+/* Size of struct grub_xfs_inode v2, up to unused4 included */
+#define XFS_V2_INODE_SIZE	(XFS_V3_INODE_SIZE - 76)
 
 struct grub_xfs_dirblock_tail
 {
Signature · 1 line
2.25.1
author
#1 lore raw

I should have cc Carlos Maiolino who authored this patch. This is now done.

Quoted 114 lines · Erwan Velu

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>
---
 grub-core/fs/xfs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
grub-core/fs/xfs.c +1 -0
index 0f524c3a8a61..becea5bcdf61 100644
@@ -192,6 +192,7 @@ struct grub_xfs_time_legacy
   grub_uint32_t nanosec;
 } GRUB_PACKED;
 
+// From

https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf
about 'struct xfs_dinode_core'
struct grub_xfs_inode

 {
   grub_uint8_t magic[2];
grub-core/fs/xfs.c +5 -5
@@ -208,14 +209,15 @@ struct grub_xfs_inode
   grub_uint32_t nextents;
   grub_uint16_t unused3;
   grub_uint8_t fork_offset;
-  grub_uint8_t unused4[37];
+  grub_uint8_t unused4[17]; // Last member of inode v2
+  grub_uint8_t unused5[20]; // First member of inode v3
   grub_uint64_t flags2;
-  grub_uint8_t unused5[48];
+  grub_uint8_t unused6[48]; // Last member of inode v3
 } GRUB_PACKED;
 
 #define XFS_V3_INODE_SIZE      sizeof(struct grub_xfs_inode)
-/* Size of struct grub_xfs_inode until fork_offset (included). */
-#define XFS_V2_INODE_SIZE      (XFS_V3_INODE_SIZE - 92)
+/* Size of struct grub_xfs_inode v2, up to unused4 included */
+#define XFS_V2_INODE_SIZE      (XFS_V3_INODE_SIZE - 76)
 
 struct grub_xfs_dirblock_tail
 {
--

2.25.1

#2 lore raw
Quoted 6 lines · Erwan Velu

I should have cc Carlos Maiolino who authored this patch. This is now done.

Le mer. 25 août 2021 à 15:32, Erwan Velu <[1][email protected]> a écrit :

Quoted 14 lines

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.

Thanks for spotting this!

Quoted 97 lines
                                  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 <[2][email protected]>
     ---
      grub-core/fs/xfs.c | 10 ++++++----
      1 file changed, 6 insertions(+), 4 deletions(-)
     diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
     index 0f524c3a8a61..becea5bcdf61 100644
     --- a/grub-core/fs/xfs.c
     +++ b/grub-core/fs/xfs.c
     @@ -192,6 +192,7 @@ struct grub_xfs_time_legacy
        grub_uint32_t nanosec;
      } GRUB_PACKED;
     +// From
     [3]https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_f
     ilesystem_structure.pdf about 'struct xfs_dinode_core'
      struct grub_xfs_inode
      {
        grub_uint8_t magic[2];
     @@ -208,14 +209,15 @@ struct grub_xfs_inode
        grub_uint32_t nextents;
        grub_uint16_t unused3;
        grub_uint8_t fork_offset;
     -  grub_uint8_t unused4[37];
     +  grub_uint8_t unused4[17]; // Last member of inode v2
     +  grub_uint8_t unused5[20]; // First member of inode v3
        grub_uint64_t flags2;
     -  grub_uint8_t unused5[48];
     +  grub_uint8_t unused6[48]; // Last member of inode v3
      } GRUB_PACKED;
      #define XFS_V3_INODE_SIZE      sizeof(struct grub_xfs_inode)
     -/* Size of struct grub_xfs_inode until fork_offset (included). */
     -#define XFS_V2_INODE_SIZE      (XFS_V3_INODE_SIZE - 92)
     +/* Size of struct grub_xfs_inode v2, up to unused4 included */
     +#define XFS_V2_INODE_SIZE      (XFS_V3_INODE_SIZE - 76)
      struct grub_xfs_dirblock_tail
      {
     --
     2.25.1

References

1. mailto:[email protected]
2. mailto:[email protected]
3. https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf

Signature · 1 line
Carlos
author
#3 lore raw
Quoted 4 lines

[...]
Thanks for spotting this!

We got hit in production with it, that's why we investigate this issue. It's deployed on our infra & works fine on the affected servers but works fine too on the servers running V5 fs.

I don't know what is the policy of this project, but a point release would make sense to avoid breaking servers that have /boot in an XFS v4. 2.06 is still young and few bumped it + reboot their machines.

Erwan,

author
#4 lore raw
In reply to Carlos Maiolino

Good day list,

Le jeu. 26 août 2021 à 15:26, Carlos Maiolino <[email protected]> a écrit :

Quoted 5 lines

[..]

Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the patch I'm fixing, agreed on the content.
This patch is important as it prevents the 2.06 version to turn XFS v4 system into an unbootable state.

#5 lore raw

Hi.

Quoted 9 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino <[1][email protected]> a écrit :

[..]
Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the patch I'm fixing, agreed on the content.

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Quoted 6 lines

This patch is important as it prevents the 2.06 version to turn XFS v4 system into an unbootable state.

References

1. mailto:[email protected]

Signature · 1 line
Carlos
#6 lore raw

CC-ing Javier...

Quoted 9 lines · Carlos Maiolino

Hi.

Quoted 7 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino <[1][email protected]> a écrit :

[..]
Thanks for spotting this!

Quoted 6 lines
Quoted 2 lines

I'm adding the maintainers in CC. Carlos who commit the patch I'm fixing, agreed on the content.

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Daniel

#7 lore raw
Quoted 12 lines · Daniel Kiper

CC-ing Javier...

Quoted 9 lines · Carlos Maiolino

Hi.

Quoted 7 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino <[1][email protected]> a écrit :

[..]
Thanks for spotting this!

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I'm adding the maintainers in CC. Carlos who commit the patch I'm fixing, agreed on the content.

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Not yet, I may be able to test it today, I let you know.

Quoted 3 lines

Daniel

Signature · 1 line
Carlos
Tested-by
#8 lore raw
In reply to Daniel Kiper
Quoted 12 lines · Daniel Kiper

CC-ing Javier...

Quoted 9 lines · Carlos Maiolino

Hi.

Quoted 7 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino <[1][email protected]> a écrit :

[..]
Thanks for spotting this!

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I'm adding the maintainers in CC. Carlos who commit the patch I'm fixing, agreed on the content.

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Feel free to add to the patch:

Quoted 3 lines

Daniel

Signature · 1 line
Carlos
#9 lore raw
Quoted 22 lines · Carlos Maiolino
Quoted 12 lines · Daniel Kiper

CC-ing Javier...

Quoted 9 lines · Carlos Maiolino

Hi.

Quoted 7 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino <[1][email protected]> a écrit :

[..]
Thanks for spotting this!

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I'm adding the maintainers in CC. Carlos who commit the patch I'm fixing, agreed on the content.

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Quoted 8 lines

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Feel free to add to the patch:

Cool! Thanks a lot!

Daniel

author
#10 lore raw
Quoted 4 lines

Cool! Thanks a lot!

I have a question about this. Considering the impact of this issue, does

this trigger a point-release of GRUB ?

#11 lore raw
Quoted 4 lines · Erwan Velu

Cool! Thanks a lot!

I have a question about this. Considering the impact of this issue, does this trigger a point-release of GRUB ?

Nope...

Daniel

author
#12 lore raw

[...]

Quoted 3 lines

Nope...

I'm pretty new at contributing to see project but I really wonder what's

the rational being this.
I mean, 2.06 is very recent, debuting its life cycle and its now known as totally broken on XFS V4 and we have here a very simple patch. How can we prevent users from installing this release ?
Can't we get a point release or even maybe a 2.07 and a statement reporting that 2.06 is not suitable for XFS v4 based system.
I'm very uncomfortable knowing the release is broken on some config (including mine) and new people will be caught in the same trap. Sorry to ask maybe a question that got asked zillion times, but that sounds important to me that we can project users that didn't reboot yet with this release.

#13 lore raw
Quoted 15 lines · Erwan Velu

[...]

     Nope...

I'm pretty new at contributing to see project but I really wonder what's the rational being this.
I mean, 2.06 is very recent, debuting its life cycle and its now known as totally broken on XFS V4 and we have here a very simple patch. How can we prevent users from installing this release ?
Can't we get a point release or even maybe a 2.07 and a statement reporting that 2.06 is not suitable for XFS v4 based system.
I'm very uncomfortable knowing the release is broken on some config (including mine) and new people will be caught in the same trap.
Sorry to ask maybe a question that got asked zillion times, but that sounds important to me that we can project users that didn't reboot yet with this release.

Making a release is a big hassle for the project right now. I hope it will change in the future but it is what it is. I think distros will take this patch immediately. If that helps I can announce here in separate thread when patch lands in the git repository.

Daniel

#14 lore raw

Le 02/09/2021 à 15:31, Daniel Kiper a écrit :

Quoted 4 lines

Making a release is a big hassle for the project right now. I hope it will change in the future but it is what it is. I think distros will take this patch immediately. If that helps I can announce here in separate thread when patch lands in the git repository.

Yeah, if we can at least point this to distro maintainers that would be a great workaround if releasing is too complex.

Thanks,

Erwan

#15 lore raw

Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

In reply to Carlos Maiolino
Quoted 23 lines · On Thu, 2 Sep 2021 10:56:49 +0200 Carlos Maiolino <[email protected]> wrote:
Quoted 15 lines · Daniel Kiper

CC-ing Javier...

Quoted 12 lines · Carlos Maiolino

Hi.

Quoted 9 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino
<[1][email protected]> a écrit :

[..]
Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the
patch I'm fixing, agreed on the content.

Quoted 6 lines
Quoted 4 lines

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Quoted 8 lines

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Feel free to add to the patch:

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that that was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been merged). To me this scenario is the poster child for taking action on this front. Can we make this a priority?

Glenn

author
#16 lore raw

Re: Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

Quoted 42 lines · Glenn Washburn
Quoted 23 lines · On Thu, 2 Sep 2021 10:56:49 +0200 Carlos Maiolino <[email protected]> wrote:
Quoted 15 lines · Daniel Kiper

CC-ing Javier...

Quoted 12 lines · Carlos Maiolino

Hi.

Quoted 9 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino
<[1][email protected]> a écrit :

[..]
Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the
patch I'm fixing, agreed on the content.

Quoted 6 lines
Quoted 4 lines

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Quoted 8 lines

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Feel free to add to the patch:

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that that was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

Quoted 10 lines

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been merged). To me this scenario is the poster child for taking action on this front. Can we make this a priority?

That also triggers to me the question of the difficulty to make a release. I'm pretty new to this project but from my other experiences, I'm missing what prevents doing a stable branch per release to perform critical updates on them.
I'm a big fan of how the Linux kernel manages this: once the commit is merged in master, it can be backported into the stable branches if the patch makes sense.
Then, the stable branch can be released whenever it makes sense. This increases the maintenance burden (but can be delegated to dedicated people) but gives users the insurance of having an up to date & secured product.

This topic was probably already addressed or questioned by the past soplease receive this as a simple questioning and not a straight criticism of the project maintenance.

#17 lore raw

Re: Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

Quoted 67 lines · Erwan Velu
Quoted 42 lines · Glenn Washburn
Quoted 23 lines · On Thu, 2 Sep 2021 10:56:49 +0200 Carlos Maiolino <[email protected]> wrote:
Quoted 15 lines · Daniel Kiper

CC-ing Javier...

Quoted 12 lines · Carlos Maiolino

Hi.

Quoted 9 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino
<[1][email protected]> a écrit :

[..]
Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the
patch I'm fixing, agreed on the content.

Quoted 6 lines
Quoted 4 lines

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Quoted 8 lines

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Feel free to add to the patch:

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that that was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

Quoted 10 lines

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been merged). To me this scenario is the poster child for taking action on this front. Can we make this a priority?

That also triggers to me the question of the difficulty to make a release. I'm pretty new to this project but from my other experiences, I'm missing what prevents doing a stable branch per release to perform critical updates on them.
I'm a big fan of how the Linux kernel manages this: once the commit is merged in master, it can be backported into the stable branches if the patch makes sense.
Then, the stable branch can be released whenever it makes sense. This increases the maintenance burden (but can be delegated to dedicated people) but gives users the insurance of having an up to date & secured product.

Quoted 3 lines

This topic was probably already addressed or questioned by the past soplease receive this as a simple questioning and not a straight criticism of the project maintenance.

The Linux project is more mature in many areas than the GRUB right now. Additionally, due to various reasons development of the GRUB almost stopped for years. Currently we are clearing the backlog and trying to regain the control on the project. So, we have to focus on most important things due to limited resources. Though I think at some point we change and improve the release process too.

Daniel

author
#18 lore raw

Re: Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

When this topic will be out, I'd would be glad to help. Cheers,
Erwan,

Quoted 87 lines · Daniel Kiper
Quoted 1 line · Erwan Velu

Le mer. 8 sept. 2021 à 03:24, Glenn Washburn <

[email protected]>

Quoted 33 lines
Quoted 31 lines · a écrit :
Quoted 28 lines · On Thu, 2 Sep 2021 10:56:49 +0200 Carlos Maiolino <[email protected]> wrote:
Quoted 15 lines · Daniel Kiper

CC-ing Javier...

Quoted 12 lines · Carlos Maiolino

Hi.

Quoted 9 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino
<[1][email protected]> a écrit :

[..]
Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the
patch I'm fixing, agreed on the content.

Quoted 6 lines
Quoted 4 lines

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Feel free to add to the patch:

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that

that

Quoted 9 lines
Quoted 9 lines

was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been

merged).

Quoted 5 lines
Quoted 4 lines

To me this scenario is the poster child for taking action on this front. Can we make this a priority?

That also triggers to me the question of the difficulty to make a

release.

Quoted 2 lines

I'm pretty new to this project but from my other experiences, I'm missing what prevents doing a stable branch per release to perform critical

updates

Quoted 11 lines

on them.
I'm a big fan of how the Linux kernel manages this: once the commit is merged in master, it can be backported into the stable branches if the patch makes sense.
Then, the stable branch can be released whenever it makes sense. This increases the maintenance burden (but can be delegated to dedicated people) but gives users the insurance of having an up to date & secured product.

This topic was probably already addressed or questioned by the past soplease receive this as a simple questioning and not a straight

criticism

Quoted 1 line

of the project maintenance.

The Linux project is more mature in many areas than the GRUB right now. Additionally, due to various reasons development of the GRUB almost stopped for years. Currently we are clearing the backlog and trying to regain the control on the project. So, we have to focus on most important things due to limited resources. Though I think at some point we change and improve the release process too.

Daniel

#19 lore raw

Re: Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

In reply to Glenn Washburn
Quoted 33 lines · Glenn Washburn
Quoted 30 lines · On Thu, 2 Sep 2021 10:56:49 +0200 Carlos Maiolino <[email protected]> wrote:
Quoted 15 lines · Daniel Kiper

CC-ing Javier...

Quoted 12 lines · Carlos Maiolino

Hi.

Quoted 9 lines · Erwan Velu

Good day list,
Le jeu. 26 août 2021 à 15:26, Carlos Maiolino
<[1][email protected]> a écrit :

[..]
Thanks for spotting this!

I'm adding the maintainers in CC. Carlos who commit the
patch I'm fixing, agreed on the content.

Quoted 6 lines
Quoted 4 lines

I didn't test the patch itself yet, but I've reproduced the issue. I was quite sure I had tested this patch on a V4 fs, but looks like I miscalculated the sizing. Thanks again. I'll try to test the patch here asap.

Did you test this patch? If yes may I add your Tested-by to it?

Yup, patch works fine, just finished testing it, I was just trying to understand where/why I miscalculated the inode size on V4 filesystems, and the reason was the same why Erwan split the last/first members of inode v2/v3 in two different unused structs.

Feel free to add to the patch:

Quoted 8 lines
Quoted 1 line

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that that was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

Currently I run build tests for all architectures and platforms and Coverity for x86_64 EFI before every push and release. I know this is not enough but I tried "make check" at least once and got the impression that the tests are not reliable. Sadly I have not time to dive deeper and fix this and that. If someone, you?, wants to verify all tests and fix broken ones I will be more than happy to start using it (it seems to me your "[PATCH v2 0/8] Various fixes/improvements for tests" patch set fixes some issues but I am not sure if all of them).

Quoted 8 lines

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been merged). To me this scenario is the poster child for taking action on this front. Can we make this a priority?

I think I can take a closer look at patch set mentioned above in a week or two. If "make check" works as expected and can be run locally then we can think about automating the testing.

Daniel

#20 lore raw

Re: Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

Quoted 9 lines · On Wed, 8 Sep 2021 18:03:50 +0200 Daniel Kiper <[email protected]> wrote:
Quoted 7 lines · Glenn Washburn

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that that was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

Quoted 9 lines

Currently I run build tests for all architectures and platforms and Coverity for x86_64 EFI before every push and release. I know this is not enough but I tried "make check" at least once and got the impression that the tests are not reliable. Sadly I have not time to dive deeper and fix this and that. If someone, you?, wants to verify all tests and fix broken ones I will be more than happy to start using it (it seems to me your "[PATCH v2 0/8] Various fixes/improvements for tests" patch set fixes some issues but I am not sure if all of them).

I suspect the problem you're running into with the tests is more a matter of setting up the expected environment than the tests themselves. From my experience, most of the tests work once everything is setup right. My gitlab patch shows how to do this on Ubuntu 20.04.

Due to not being able to load kernel modules on the shared gitlab runners, I was not able to run all the tests either, and there are some tests that fail. The failures that come to mind are on Sparc and some of the functional tests, and I've notified the list, but no one came forward to fix them. So what I've done is have a list of known failing tests and ignore those in determining whether the test suite as a whole has succeeded. I'm not convinced that that behavior is something we should include in the test framework itself.

So to my mind, I have verified (nearly) all tests on most platforms. I have fixed the ones I could. I think the biggest low hanging fruit (for me), is to get the tests running on a system with all the needed kernel fs drivers loaded. Perhaps to your point, the filesystem tests failing due to not having a kernel module loaded should be marked as skipped because the test isn't really run.

Here is an example of a successfully completed pipeline
https://gitlab.com/gwashburn/grub/-/pipelines/258561619

And here is the raw log for the x86_64-efi build and test (search for "Testsuite summary" and look at the lines above for individual test pass/fail):
https://storage.googleapis.com/gitlab-gprd-artifacts/0e/0d/0e0d2ccc27a1e9a121b3d4ef831c56b5fd81cc8b565a3dbc5fa09b9a58edbcb7/2021_02_19/1042905700/1137549157/job.log?response-content-type=text%2Fplain%3B%20charset%3Dutf-8&response-content-disposition=inline&GoogleAccessId=gitlab-object-storage-prd@gitlab-production.iam.gserviceaccount.com&Signature=ewpRWBqWWorOXak6hFkb5kUEfefU1biAtu6xY2Rtyds3%2BduM6q0kiFIKe4A5%0A8wS%2FPbd8Al3AwF45Q22KcpYyZ87UBkryQHjispAj%2B3tBQrnnyOYSRKGNV%2Bbz%0A4iaKAdYn4onIcJM9Ro4RkJ%2FCAY2tBxWmmLoEZ%2FQzWLvbhH%2BJSmuNqtEZXfuD%0AI1tXD1ZKgoLcYCCLNz8iaMFpgB32NfR2W6sDDuFb24ZFSy0X7H02KRVAMIor%0Akhj5QXdXGqoqFFXXMM9r8ZGv34Kh4GdDbVjMmJ%2FaDhvLPgmZF3UKnhcDYJoB%0AiMj%2BbimYNoiQW0SLg4hHA11PkKNn4KPAFqhLVscsCw%3D%3D&Expires=1631130462

This is all to show that the tests are (mostly) working. There's some post-processing on the pass/fail status of some tests to ignore expected failures (eg. zfs_test). Occasionally there are spurious test failures, I think due to the VM getting starved at times (eg. why grub_cmd_sleep fails and is ignored).

No as far as you personally using the tests, based on the above what do we need to get that to happen? I don't know the setup that you plan on doing the tests on (is it debian based?). Do you want a script that sets up the environment for you? Perhaps a docker or lxd setup (probably better in the long run)?

A word about why I haven't verified the fs tests that require kernel modules not loaded in gitlab shared runner, I could run these on my system. However, I've had some strange experiences in the past with the fs tests not cleaning up well and causing some issues with the rest of the system. So I'm not keen on running all the fs tests on my daily driver. Perhaps in a container (a virtual machine would work, but I suspect really slow, because many of the tests use virtual machines for testing, so there would be VMs in a VM).

I'd be curious to know what specific issues you had with the test, if you can remember or reproduce them.

Quoted 9 lines
Quoted 8 lines

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been merged). To me this scenario is the poster child for taking action on this front. Can we make this a priority?

Quoted 3 lines

I think I can take a closer look at patch set mentioned above in a week or two. If "make check" works as expected and can be run locally then we can think about automating the testing.

I think the requirement to "run locally" should be more precisely defined. Is that all tests for all architectures? Running it reliably on an local machine might be difficult due to the variability of configurations. Perhaps in a docker or lxd container would be the best route for that. Thoughts?

Glenn

#21 lore raw

Re: Where is the testing? (was: Re: [PATCH] fs/xfs: Avoid unreadble filesystem if V4 superblock)

Quoted 88 lines · Glenn Washburn
Quoted 9 lines · On Wed, 8 Sep 2021 18:03:50 +0200 Daniel Kiper <[email protected]> wrote:
Quoted 7 lines · Glenn Washburn

It looks like the xfs_test test succeeds with tag grub-2.06-rc1a, fails with tag grub-2.06, and succeeds with current master. Yes, as expected. However, what this tells me is that no "make check" tests were done before finalizing the 2.06 release. I was under the impression that that was part of the release procedure. If its not, it would seem that we're not using the tests at a time when they would have the most impact.

Quoted 9 lines

Currently I run build tests for all architectures and platforms and Coverity for x86_64 EFI before every push and release. I know this is not enough but I tried "make check" at least once and got the impression that the tests are not reliable. Sadly I have not time to dive deeper and fix this and that. If someone, you?, wants to verify all tests and fix broken ones I will be more than happy to start using it (it seems to me your "[PATCH v2 0/8] Various fixes/improvements for tests" patch set fixes some issues but I am not sure if all of them).

I suspect the problem you're running into with the tests is more a matter of setting up the expected environment than the tests themselves. From my experience, most of the tests work once everything is setup right. My gitlab patch shows how to do this on Ubuntu 20.04.

Due to not being able to load kernel modules on the shared gitlab runners, I was not able to run all the tests either, and there are some tests that fail. The failures that come to mind are on Sparc and some of the functional tests, and I've notified the list, but no one came forward to fix them. So what I've done is have a list of known failing tests and ignore those in determining whether the test suite as a whole has succeeded. I'm not convinced that that behavior is something we should include in the test framework itself.

So to my mind, I have verified (nearly) all tests on most platforms. I have fixed the ones I could. I think the biggest low hanging fruit (for me), is to get the tests running on a system with all the needed kernel fs drivers loaded. Perhaps to your point, the filesystem tests failing due to not having a kernel module loaded should be marked as skipped because the test isn't really run.

Here is an example of a successfully completed pipeline
https://gitlab.com/gwashburn/grub/-/pipelines/258561619

And here is the raw log for the x86_64-efi build and test (search for "Testsuite summary" and look at the lines above for individual test pass/fail):
https://storage.googleapis.com/gitlab-gprd-artifacts/0e/0d/0e0d2ccc27a1e9a121b3d4ef831c56b5fd81cc8b565a3dbc5fa09b9a58edbcb7/2021_02_19/1042905700/1137549157/job.log?response-content-type=text%2Fplain%3B%20charset%3Dutf-8&response-content-disposition=inline&GoogleAccessId=gitlab-object-storage-prd@gitlab-production.iam.gserviceaccount.com&Signature=ewpRWBqWWorOXak6hFkb5kUEfefU1biAtu6xY2Rtyds3%2BduM6q0kiFIKe4A5%0A8wS%2FPbd8Al3AwF45Q22KcpYyZ87UBkryQHjispAj%2B3tBQrnnyOYSRKGNV%2Bbz%0A4iaKAdYn4onIcJM9Ro4RkJ%2FCAY2tBxWmmLoEZ%2FQzWLvbhH%2BJSmuNqtEZXfuD%0AI1tXD1ZKgoLcYCCLNz8iaMFpgB32NfR2W6sDDuFb24ZFSy0X7H02KRVAMIor%0Akhj5QXdXGqoqFFXXMM9r8ZGv34Kh4GdDbVjMmJ%2FaDhvLPgmZF3UKnhcDYJoB%0AiMj%2BbimYNoiQW0SLg4hHA11PkKNn4KPAFqhLVscsCw%3D%3D&Expires=1631130462

This is all to show that the tests are (mostly) working. There's some post-processing on the pass/fail status of some tests to ignore expected failures (eg. zfs_test). Occasionally there are spurious test failures, I think due to the VM getting starved at times (eg. why grub_cmd_sleep fails and is ignored).

No as far as you personally using the tests, based on the above what do we need to get that to happen? I don't know the setup that you plan on doing the tests on (is it debian based?). Do you want a script that sets up the environment for you? Perhaps a docker or lxd setup (probably better in the long run)?

A word about why I haven't verified the fs tests that require kernel modules not loaded in gitlab shared runner, I could run these on my system. However, I've had some strange experiences in the past with the fs tests not cleaning up well and causing some issues with the rest of the system. So I'm not keen on running all the fs tests on my daily driver. Perhaps in a container (a virtual machine would work, but I suspect really slow, because many of the tests use virtual machines for testing, so there would be VMs in a VM).

I'd be curious to know what specific issues you had with the test, if you can remember or reproduce them.

Quoted 9 lines
Quoted 8 lines

It is my understanding that we have travis-ci tests that get run (at some point?), however they are only build tests and so would not have caught this. It was precisely this scenario that I hoped to avoid by doing more thorough continuous integration, which runs the extensive array of "make check" tests, when I submitted the Gitlab-CI patch series (which would've caught this automatically if it had been merged). To me this scenario is the poster child for taking action on this front. Can we make this a priority?

Quoted 3 lines

I think I can take a closer look at patch set mentioned above in a week or two. If "make check" works as expected and can be run locally then we can think about automating the testing.

Quoted 5 lines

I think the requirement to "run locally" should be more precisely defined. Is that all tests for all architectures? Running it reliably on an local machine might be difficult due to the variability of configurations. Perhaps in a docker or lxd container would be the best route for that. Thoughts?

First of all, thank you for doing so much experiments and describing the results. I believe we can use your knowledge to improve the GRUB testing.

I think everybody should be able to run all or at least most tests on their local machines, baremetal or VM. So, we should have a clear description how to do that, e.g., in the INSTALL and maybe docs/grub-dev.texi files. It seems to me the reference config should be based on latest Debian stable. It should list the packages needed to install, important changes needed to make tests work, etc. If some binaries needed to build the GRUB for a given platform or run tests are missing from Debian I am OK with pointing people to the well known and trusted repositories, e.g. [1] and [2]. If we know some tests may fail in some situations we have to document it. When we are sure this basic setup works then we can think how to use containers, if some want to, automate these tests and run them on the upstream repository.

Daniel

[1] https://mirrors.kernel.org/pub/tools/crosstool/
[2] https://toolchains.bootlin.com/

Reviewed-by on v1 1/1
#22 lore raw
In reply to Erwan Velu
Quoted 68 lines · Erwan Velu

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>
Quoted 1 line

Daniel