From: sashiko-bot@kernel.org
To: ebiggers@kernel.org, gregkh@linuxfoundation.org,
djwong@kernel.org, fsverity@lists.linux.dev, hch@lst.de,
jack@suse.cz
Cc: stable-commits@vger.kernel.org
Subject: Re: Patch "fs,fsverity: reject size changes on fsverity files in setattr_prepare" has been added to the 6.18-stable tree
Date: Wed, 07 Oct 2026 06:41:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-162680@kernel.org> (raw)
In-Reply-To: <2026100754-drizzle-shape-0a72@gregkh>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] vfs: verity file truncation bypass when CONFIG_FS_VERITY is disabled
--
commit 750dd8cb058f7ea5d2ca5305006f1c5e63c6eb32
Author: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
fs,fsverity: reject size changes on fsverity files in setattr_prepare
This commit centralizes the check to reject truncates of fsverity files
into setattr_prepare() in fs/attr.c. This removes boilerplate code from
individual filesystems and fixes a missing truncation check in btrfs.
Link: https://lore.kernel.org/r/20260128152630.627409-2-hch@lst.de
> diff --git a/fs/attr.c b/fs/attr.c
> index 795f231d00e8e..2c94af08be183 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -169,7 +169,17 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
> * ATTR_FORCE.
> */
> if (ia_valid & ATTR_SIZE) {
> - int error = inode_newsize_ok(inode, attr->ia_size);
> + int error;
> +
> + /*
> + * Verity files are immutable, so deny truncates. This isn't
> + * covered by the open-time check because sys_truncate() takes a
> + * path, not an open file.
> + */
> + if (IS_ENABLED(CONFIG_FS_VERITY) && IS_VERITY(inode))
> + return -EPERM;
[Severity: High]
Does this logic inadvertently permit truncating verity files when
CONFIG_FS_VERITY is disabled?
Before this patch, filesystems explicitly called fsverity_prepare_setattr().
When CONFIG_FS_VERITY was disabled, the fallback implementation safely returned
-EOPNOTSUPP for any inode with the verity flag set.
By short-circuiting the check here with IS_ENABLED(CONFIG_FS_VERITY), it
appears an unprivileged user with DAC write access could use sys_truncate()
to bypass the check and modify a verity file if the kernel was built without
fsverity support.
--
Sashiko AI review · https://sashiko.dev/#/patchset/2026100754-drizzle-shape-0a72@gregkh?part=1
next prev parent reply other threads:[~2026-10-07 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 21:36 [PATCH 6.18 0/2] Forbid truncate of fsverity files on btrfs Eric Biggers
2026-10-06 21:36 ` [PATCH 6.18 1/2] fs,fsverity: reject size changes on fsverity files in setattr_prepare Eric Biggers
2026-10-07 6:32 ` Patch "fs,fsverity: reject size changes on fsverity files in setattr_prepare" has been added to the 6.18-stable tree gregkh
2026-10-07 6:41 ` sashiko-bot [this message]
2026-10-06 21:36 ` [PATCH 6.18 2/2] fs,fsverity: remove check for fsverity being enabled in setattr_prepare() Eric Biggers
2026-10-07 6:32 ` Patch "fs,fsverity: remove check for fsverity being enabled in setattr_prepare()" has been added to the 6.18-stable tree gregkh
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=sashiko-outbox-162680@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=djwong@kernel.org \
--cc=ebiggers@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=sashiko-reviews@lists.linux.dev \
--cc=stable-commits@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