Skip to contentSkip to conversation

ext2fs: Fix build of new superblock fields on BE machines

PATCH Applied Gabriel Krisman Bertazi 2 participants 4 messages Nov 21, 2018 – Nov 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext2fs: Fix build of new superblock fields on BE machines

New superblock fields must be byte swapped before being accessed in Big Endian machines.

Not tested on an actual BE machine.

---

I just noticed this today. I don't see the patch that includes this field already pushed to kernel.org, so if you want to squash this one to that patch before pushing to make the result more bisectable in BE machines, I am ok with that.

 lib/ext2fs/swapfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/ext2fs/swapfs.c +4 -1
index b168a2f20208..a1560045d073 100644
@@ -129,8 +129,11 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
 	sb->s_lpf_ino = ext2fs_swab32(sb->s_lpf_ino);
 	sb->s_prj_quota_inum = ext2fs_swab32(sb->s_prj_quota_inum);
 	sb->s_checksum_seed = ext2fs_swab32(sb->s_checksum_seed);
+	/* s_*_time_hi are __u8 and does not need swabbing */
+	sb->s_encoding = ext2fs_swab16(sb->s_encoding);
+	sb->s_encoding_flags = ext2fs_swab16(sb->s_encoding_flags);
 	/* catch when new fields are used from s_reserved */
-	EXT2FS_BUILD_BUG_ON(sizeof(sb->s_reserved) != 98 * sizeof(__le32));
+	EXT2FS_BUILD_BUG_ON(sizeof(sb->s_reserved) != 95 * sizeof(__le32));
 	sb->s_checksum = ext2fs_swab32(sb->s_checksum);
 }
 
Signature · 1 line
2.19.1
#1 lore raw
Quoted 5 lines · Gabriel Krisman Bertazi

New superblock fields must be byte swapped before being accessed in Big Endian machines.

Not tested on an actual BE machine.

Quoted 7 lines

---

I just noticed this today. I don't see the patch that includes this field already pushed to kernel.org, so if you want to squash this one to that patch before pushing to make the result more bisectable in BE machines, I am ok with that.

Oops, sorry, I just pushed it out before I saw your note. I'll add it as a follow-on commit right away. Fortunately we don't do too much debugging on BE machines, so it's probably not worth breaking the git rules and rewinding, even though it's highly unlikely anyone has done a git pull in the last 10 minutes or so.

While we're at it, I should have noticed this earler before I acceptd patch 2 in your series. Could you also send a follow up patch which adds a quick description of the fname_encoding feature to the ext4.5 man page?

Also, did your v2 patch series to e2fsprogs reflect any of the comments I made late last night on the rest of the v1 patch series?

Thanks, regards,

- Ted

#2 lore raw
Quoted 22 lines · Theodore Y. Ts'o
Quoted 5 lines · Gabriel Krisman Bertazi

New superblock fields must be byte swapped before being accessed in Big Endian machines.

Not tested on an actual BE machine.

Quoted 7 lines

---

I just noticed this today. I don't see the patch that includes this field already pushed to kernel.org, so if you want to squash this one to that patch before pushing to make the result more bisectable in BE machines, I am ok with that.

Oops, sorry, I just pushed it out before I saw your note. I'll add it as a follow-on commit right away. Fortunately we don't do too much debugging on BE machines, so it's probably not worth breaking the git rules and rewinding, even though it's highly unlikely anyone has done a git pull in the last 10 minutes or so.

Quoted 4 lines

While we're at it, I should have noticed this earler before I acceptd patch 2 in your series. Could you also send a follow up patch which adds a quick description of the fname_encoding feature to the ext4.5 man page?

Hi,

Thanks for pushing it and yes, I can send the follow up patch.

Quoted 3 lines

Also, did your v2 patch series to e2fsprogs reflect any of the comments I made late last night on the rest of the v1 patch series?

No, it only reflects the comments you made on the night before, up to patch 3/10, as I hadn't seen your new responses before submitting v2.

So, please disregard v2, and I will follow up with a new iteration applying your new suggestions.

Thanks.

Signature · 1 line
Gabriel Krisman Bertazi