From: Peng Hao <flyingpenghao@gmail.com>
To: jack@suse.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] ext2: Set the superblock UUID
Date: Mon, 23 Nov 2026 12:48:26 +0800 [thread overview]
Message-ID: <20261123044826.93953-1-flyingpeng@tencent.com> (raw)
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 a40f530872a4..5e36007b3ffd 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 reply other threads:[~2026-11-23 4:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 4:48 Peng Hao [this message]
2026-11-23 4:54 ` [PATCH] ext2: Set the superblock UUID sashiko-bot
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=20261123044826.93953-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox