ext4: Refuse to mount filesystems with 64bit feature set
PATCH 1/1 ext4: Refuse to mount filesystems with 64bit feature set
With e2fsprogs after 1.43 the 64bit and metadata_csum features are enabled by default. The metadata_csum feature changes how ext4_group_desc->bg_checksum is calculated, which would break write support. The 64bit feature however introduces changes such that it cannot be read by implementations that do not support it. Since we do not support this, we must not mount it.
---
This problem has been seen in the wild a few times and reported in many places. If you've also found this problem, and reported it, please feel free to reply with a Reported-by tag, patchwork will pick them up. Further, we should look at adding support for 64bit and metadata_csum features as they will be showing up a lot more often now, but that's also non-trivial. A graceful fail like this is better than users being unable to load their files and being very puzzled.
--- fs/ext4/ext4_common.c | 10 ++++++++++ include/ext4fs.h | 1 + 2 files changed, 11 insertions(+)
fs/ext4/ext4_common.c +10 -0
@@ -2229,6 +2229,16 @@ int ext4fs_mount(unsigned part_length)if (__le16_to_cpu (data->sblock.magic) !=EXT2_MAGIC ) goto fail; +/* +* The 64bit feature was enabled when metadata_csum was enabled +* and we do not support metadata_csum (and cannot reliably find +* files when it is set. Refuse to mount. +*/ +if (data->sblock.feature_incompat &EXT4_FEATURE_INCOMPAT_64BIT ) { +printf ("Unsupported feature found (64bit, possibly metadata_csum), not mounting\n" ); + goto fail; + } +if (__le32_to_cpu (data->sblock.revision_level ==0 )) fs->inodesz =128 ;else
include/ext4fs.h +1 -0
@@ -32,6 +32,7 @@#define EXT4_EXT_MAGIC 0xf30a#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 +#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080#define EXT4_INDIRECT_BLOCKS 12#define EXT4_BG_INODE_UNINIT 0x0001
Signature · 1 line
2.7.4
PATCH 1/1 ext4: Refuse to mount filesystems with 64bit feature set
Quoted 31 lines · Tom Rini
With e2fsprogs after 1.43 the 64bit and
metadata_csumfeatures are enabled by default. Themetadata_csumfeature changes howext4_group_desc->bg_checksumis calculated, which would break write support. The 64bit feature however introduces changes such that it cannot be read by implementations that do not support it. Since we do not support this, we must not mount it.Cc Stephen Warren <[email protected]>Cc Simon Glass <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Stefan Roese <[email protected]>Reported-by Andrew Bradford <[email protected]>Signed-off-by Tom Rini <[email protected]>---
This problem has been seen in the wild a few times and reported in many places. If you've also found this problem, and reported it, please feel free to reply with a Reported-by tag, patchwork will pick them up. Further, we should look at adding support for 64bit andmetadata_csumfeatures as they will be showing up a lot more often now, but that's also non-trivial. A graceful fail like this is better than users being unable to load their files and being very puzzled.--- fs/ext4/ext4_common.c | 10 ++++++++++ include/ext4fs.h | 1 + 2 files changed, 11 insertions(+)fs/ext4/ext4_common.c +0
-0
fs/ext4/ext4_common.c int ext4fs_mount(unsigned part_length) · line 2236
Quoted 8 lines
fs/ext4/ext4_common.c +5
-0@@ -2229,6 +2229,16 @@ int ext4fs_mount(unsigned part_length)if (__le16_to_cpu (data->sblock.magic) !=EXT2_MAGIC ) goto fail; +/* +* The 64bit feature was enabled when metadata_csum was enabled +* and we do not support metadata_csum (and cannot reliably find +* files when it is set. Refuse to mount. +*/
OK, I wrote the comment before I wrote the commit message, which I wrote after re-reading
https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout. I got stuck on metadata_csum being the cause rather than 64bit being the true "we must not read" problem. I'll re-word the comment to:
The 64bit feature was enabled and this changes a number of data structures such that we cannot find files. Refuse to mount.
fs/ext4/ext4_common.c int ext4fs_mount(unsigned part_length) · line 2238
Quoted 2 lines
fs/ext4/ext4_common.c +2
-0+if (data->sblock.feature_incompat &EXT4_FEATURE_INCOMPAT_64BIT ) { +printf ("Unsupported feature found (64bit, possibly metadata_csum), not mounting\n" );
And this to:
Unsupported feature found: 64bit. Not mounting
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/f9f0da82/attachment.sig>
PATCH 1/1 ext4: Refuse to mount filesystems with 64bit feature set
In reply to Tom RiniQuoted 7 lines · Tom Rini
With e2fsprogs after 1.43 the 64bit and
metadata_csumfeatures are enabled by default. Themetadata_csumfeature changes howext4_group_desc->bg_checksumis calculated, which would break write support. The 64bit feature however introduces changes such that it cannot be read by implementations that do not support it. Since we do not support this, we must not mount it.
Quoted 6 lines
Cc Stephen Warren <[email protected]>Cc Simon Glass <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Stefan Roese <[email protected]>Reported-by Andrew Bradford <[email protected]>Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160805/cc60aa4e/attachment.sig>