* [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata()
@ 2026-10-21 22:40 Eric Biggers
2026-10-22 9:17 ` Andrey Albershteyn
0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2026-10-21 22:40 UTC (permalink / raw)
To: fsverity; +Cc: Eric Biggers
The comment in fsverity_ioctl_read_metadata(), which justifies not
checking for FMODE_READ, doesn't consider that the nonstandard access
mode 3 (ioctl-only) exists.
It's reasonable to continue to allow this ioctl in that case, since this
*is* an ioctl, and opening a file with mode 3 checks for read (and
write) access. However, adjust the comment to not be misleading.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
fs/verity/read_metadata.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/verity/read_metadata.c b/fs/verity/read_metadata.c
index b4c0892430cde..5e81847bdb036 100644
--- a/fs/verity/read_metadata.c
+++ b/fs/verity/read_metadata.c
@@ -170,8 +170,9 @@ int fsverity_ioctl_read_metadata(struct file *filp, const void __user *uarg)
if (!vi)
return -ENODATA; /* not a verity file */
/*
- * Note that we don't have to explicitly check that the file is open for
- * reading, since verity files can only be opened for reading.
+ * No need to check for FMODE_READ. Verity files can't be open for
+ * writing, and opening with access mode 3 (ioctl-only) requires read
+ * (and write) permission, so the opener has read permission either way.
*/
if (copy_from_user(&arg, uarg, sizeof(arg)))
base-commit: ccc4d9f8912a5d9f519a34c3633fe53c8f9b429e
--
2.56.0.218.g1ec904b173-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata()
2026-10-21 22:40 [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata() Eric Biggers
@ 2026-10-22 9:17 ` Andrey Albershteyn
2026-10-22 19:59 ` Eric Biggers
0 siblings, 1 reply; 3+ messages in thread
From: Andrey Albershteyn @ 2026-10-22 9:17 UTC (permalink / raw)
To: Eric Biggers; +Cc: fsverity
On 2026-10-21 22:40:30, Eric Biggers wrote:
> The comment in fsverity_ioctl_read_metadata(), which justifies not
> checking for FMODE_READ, doesn't consider that the nonstandard access
> mode 3 (ioctl-only) exists.
>
> It's reasonable to continue to allow this ioctl in that case, since this
> *is* an ioctl, and opening a file with mode 3 checks for read (and
> write) access. However, adjust the comment to not be misleading.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Looks good to me
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
--
- Andrey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata()
2026-10-22 9:17 ` Andrey Albershteyn
@ 2026-10-22 19:59 ` Eric Biggers
0 siblings, 0 replies; 3+ messages in thread
From: Eric Biggers @ 2026-10-22 19:59 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: fsverity
On Thu, Oct 22, 2026 at 11:17:26AM +0200, Andrey Albershteyn wrote:
> On 2026-10-21 22:40:30, Eric Biggers wrote:
> > The comment in fsverity_ioctl_read_metadata(), which justifies not
> > checking for FMODE_READ, doesn't consider that the nonstandard access
> > mode 3 (ioctl-only) exists.
> >
> > It's reasonable to continue to allow this ioctl in that case, since this
> > *is* an ioctl, and opening a file with mode 3 checks for read (and
> > write) access. However, adjust the comment to not be misleading.
> >
> > Signed-off-by: Eric Biggers <ebiggers@kernel.org>
>
> Looks good to me
> Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
Thanks. I'm actually reconsidering this patch, though:
* This ioctl returns hashes of file contents blocks, which reveal
information that normally a read would be needed for.
* "opening a file with mode 3 checks for read (and write) access"
is true for the DAC permissions, but it's not true for some LSMs such
as Landlock where it bypasses their read permission check.
So requiring FMODE_READ for this might be the way to go.
- Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-22 19:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 22:40 [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata() Eric Biggers
2026-10-22 9:17 ` Andrey Albershteyn
2026-10-22 19:59 ` Eric Biggers
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.