From: Peng Hao <flyingpenghao@gmail.com>
To: jack@suse.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 2/2] ext2: Set the superblock UUID
Date: Tue, 24 Nov 2026 19:17:08 +0800 [thread overview]
Message-ID: <20261124111708.24204-2-flyingpeng@tencent.com> (raw)
In-Reply-To: <20261124111708.24204-1-flyingpeng@tencent.com>
ext2_fill_super() never sets sb->s_uuid, so everything that uses the
filesystem UUID through the VFS sees a null UUID on ext2:
- IMA/EVM policy rules with fsuuid= never match;
- EVM HMACs that include the UUID (EVM_ATTR_FSUUID) don't bind to the
filesystem;
- FS_IOC_GETFSUUID fails with -ENOTTY;
- overlayfs can't tell lower layers on different ext2 filesystems apart
and falls back to xino=off,index=off,nfs_export=off.
This was found with the BPF selftest test_ima, which creates an ext2
image, adds a "measure func=BPRM_CHECK fsuuid=<uuid>" rule and expects
a binary executed from that image to be measured. It only passes when
ext2 images are mounted by ext4 (CONFIG_EXT4_USE_FOR_EXT2), which sets
the UUID. With CONFIG_EXT2_FS=y nothing is measured:
test_test_ima:FAIL:num_samples_or_err unexpected num_samples_or_err: actual 0 != expected 1
Set the UUID from the on-disk superblock the same way ext4 does.
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
fs/ext2/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 8a4412231394..b4df4123313d 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1007,6 +1007,7 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
sb->s_max_links = EXT2_LINK_MAX;
sb->s_time_min = S32_MIN;
sb->s_time_max = S32_MAX;
+ super_set_uuid(sb, es->s_uuid, sizeof(es->s_uuid));
if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) {
sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE;
--
2.43.7
next prev parent reply other threads:[~2026-11-24 11:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 11:17 [PATCH 1/2] ext2: Reject a superblock with an invalid s_first_ino Peng Hao
2026-11-24 11:17 ` Peng Hao [this message]
2026-11-24 11:22 ` sashiko-bot
2026-11-24 16:07 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124111708.24204-2-flyingpeng@tencent.com \
--to=flyingpenghao@gmail.com \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.