From: Mimi Zohar <zohar@linux.ibm.com>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>, linux-integrity@vger.kernel.org
Subject: Re: [PATCH] ima: return error early if file xattr cannot be changed
Date: Thu, 23 Apr 2026 09:11:33 -0400 [thread overview]
Message-ID: <03597d02213b4e1a6942a5fffb5bda233bbc2e76.camel@linux.ibm.com> (raw)
In-Reply-To: <aposxvqsrlbe7gtyvtsdh5nyg5sgofimerqpt6ez4fbxhtqyjj@4u3othdcgipp>
On Wed, 2026-04-22 at 07:34 -0400, Goldwyn Rodrigues wrote:
> During early boot, the filesystem is read-only and any changes
> to xattrs are not allowed. This fails in case of ext4 because
> changing xattr starts an ext4 transaction which fails with the
> following warning.
>
> WARNING: fs/ext4/ext4_jbd2.c:75 at ext4_journal_check_start+0x63/0xa0 [ext4], CPU#1: systemd-sysroot/561
> CPU: 1 UID: 0 PID: 561 Comm: systemd-sysroot Not tainted 6.19.12-1-default #1 PREEMPT(voluntary) openSUSE Tumbleweed c2dfc3c9d9f6f1233251c5d4410574fe82a348ee
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022
> RIP: 0010:ext4_journal_check_start+0x63/0xa0 [ext4]
> Call Trace:
> __ext4_journal_start_sb+0x3e/0x180 [ext4 6d025f3bc52c89a957b89a89d211fadf5e9434e1]
> ext4_xattr_set+0x104/0x150 [ext4 6d025f3bc52c89a957b89a89d211fadf5e9434e1]
> __vfs_setxattr+0x9a/0xd0
> __vfs_setxattr_noperm+0x76/0x1f0
> ima_appraise_measurement+0x23e/0xe40
> ima_d_path+0x5a/0xd0
> process_measurement+0xb29/0xc40
> ? copy_from_kernel_nofault+0x21/0xe0
> ? fscrypt_file_open+0xc0/0xe0
> ? ext4_file_open+0x60/0x490 [ext4 6d025f3bc52c89a957b89a89d211fadf5e9434e1]
> ? bpf_prog_31efb7c56239148b_restrict_filesystems+0xab/0x126
> ? __bpf_prog_exit+0x23/0xd0
> ? __bpf_tramp_exit+0xd/0x50
> ? bpf_trampoline_6442530367+0x9f/0xea
> ima_file_check+0x57/0x80
> security_file_post_open+0x50/0xf0
> path_openat+0x493/0x1650
> do_filp_open+0xc7/0x170
>
> Detect the state of the file early and return the error.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Thank you! The patch makes a lot of sense.
Mimi
> ---
> security/integrity/ima/ima_appraise.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
> index 870dde67707b..6a4dda46114c 100644
> --- a/security/integrity/ima/ima_appraise.c
> +++ b/security/integrity/ima/ima_appraise.c
> @@ -90,6 +90,11 @@ static int ima_fix_xattr(struct dentry *dentry,
> int rc, offset;
> u8 algo = iint->ima_hash->algo;
>
> + if (IS_RDONLY(d_inode(dentry)))
> + return -EROFS;
> + if (IS_IMMUTABLE(d_inode(dentry)))
> + return -EPERM;
> +
> if (algo <= HASH_ALGO_SHA1) {
> offset = 1;
> iint->ima_hash->xattr.sha1.type = IMA_XATTR_DIGEST;
prev parent reply other threads:[~2026-04-23 13:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-22 11:34 [PATCH] ima: return error early if file xattr cannot be changed Goldwyn Rodrigues
2026-04-23 13:11 ` Mimi Zohar [this message]
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=03597d02213b4e1a6942a5fffb5bda233bbc2e76.camel@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=linux-integrity@vger.kernel.org \
--cc=rgoldwyn@suse.de \
/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