From: sashiko-bot@kernel.org
To: "Eric Biggers" <ebiggers@kernel.org>
Cc: fsverity@lists.linux.dev, "Andrey Albershteyn" <aalbersh@kernel.org>
Subject: Re: [PATCH 5.15] fsverity: Explicitly require FMODE_READ to retrieve hashes
Date: Sat, 07 Nov 2026 19:19:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-203202@kernel.org> (raw)
In-Reply-To: <20261107191131.30975-1-ebiggers@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] fsverity: missing FMODE_READ check in fsverity_ioctl_enable()
--
commit 6f42601569a4e27dbe2802c031c26b860ad70602
Author: Eric Biggers <ebiggers@kernel.org>
fsverity: Explicitly require FMODE_READ to retrieve hashes
This commit requires FMODE_READ in fsverity_ioctl_measure() and
fsverity_ioctl_read_metadata() so that ioctl-only file descriptors cannot
be used to retrieve file hashes without passing LSM read-permission
checks, and documents EBADF for the fs-verity ioctls.
Link: https://patch.msgid.link/20261022211522.1489943-1-ebiggers@kernel.org
> diff --git a/Documentation/filesystems/fsverity.rst b/Documentation/filesystems/fsverity.rst
> index 1d831e3cbcb33..073bb57334c45 100644
> --- a/Documentation/filesystems/fsverity.rst
> +++ b/Documentation/filesystems/fsverity.rst
> @@ -146,6 +146,7 @@ fatal signal), no changes are made to the file.
> FS_IOC_ENABLE_VERITY can fail with the following errors:
>
> - ``EACCES``: the process does not have write access to the file
> +- ``EBADF``: the file descriptor is not open for reading
> - ``EBADMSG``: the signature is malformed
> - ``EBUSY``: this ioctl is already running on the file
> - ``EEXIST``: the file already has verity enabled
[Severity: Medium]
Should fsverity_ioctl_enable() also check FMODE_READ in this branch?
This hunk documents EBADF for FS_IOC_ENABLE_VERITY, and the commit message
notes that ioctl-only file descriptors were already disallowed for
FS_IOC_ENABLE_VERITY, but in this branch fsverity_ioctl_enable() only
checks file_permission(filp, MAY_WRITE) and deny_write_access(filp), and
read_file_data_page() reads directly from filp->f_mapping rather than
through __kernel_read():
fs/verity/enable.c:fsverity_ioctl_enable() {
...
err = file_permission(filp, MAY_WRITE);
if (err)
return err;
...
err = deny_write_access(filp);
if (err) /* -ETXTBSY */
goto out_drop_write;
err = enable_verity(filp, &arg);
...
}
Because an ioctl-only (access mode 3) file descriptor has neither
FMODE_READ nor FMODE_WRITE set and does not increment inode->i_writecount,
FS_IOC_ENABLE_VERITY still succeeds on an ioctl-only fd without passing
security_file_open() read/write checks in LSMs such as Landlock or
AppArmor (and fails with -ETXTBSY rather than -EBADF on a write-only fd).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261107191131.30975-1-ebiggers@kernel.org?part=1
prev parent reply other threads:[~2026-11-07 19:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 19:11 [PATCH 5.15] fsverity: Explicitly require FMODE_READ to retrieve hashes Eric Biggers
2026-11-07 19:19 ` sashiko-bot [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=sashiko-outbox-203202@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aalbersh@kernel.org \
--cc=ebiggers@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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.