[PATCH] fsverity: Explicitly require FMODE_READ to retrieve hashes

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Oct 22 21:18:58 UTC 2026


> 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.
> 
> Opening an ioctl-only fd generally requires read (and write) permission.
> However, there are gaps with certain LSMs: an ioctl-only fd requests
> read (and write) permission via security_inode_permission, but not
> security_file_open.  With certain LSMs relying on the latter, such as
> Landlock and AppArmor, an ioctl-only fd can be opened without the LSM
> granting read (and write) permission.
> 
> Since FS_IOC_READ_VERITY_METADATA returns hashes of file contents
> blocks, it should require read permission.  This also applies to
> FS_IOC_MEASURE_VERITY, which returns a hash for the whole file.
> 
> [ ... ]
> 
> Fixes: 4dd893d832cf ("fs-verity: implement FS_IOC_MEASURE_VERITY ioctl")
> Fixes: e17fe6579de0 ("fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl")
> Cc: stable at vger.kernel.org
> Signed-off-by: Eric Biggers <ebiggers at kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022211522.1489943-1-ebiggers@kernel.org?part=1




More information about the Linux-security-module-archive mailing list