Skip to contentSkip to conversation

fs,fsverity: remove check for fsverity being enabled in setattr_prepare()

PATCH Applied Andrey Albershteyn 2 participants 2 messages Jul 27 – Jul 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs,fsverity: remove check for fsverity being enabled in setattr_prepare()

The check that fs-verity is available in the kernel is not necessary here. Filesystems could have fsverity files even without fs-verity enabled. In that case, truncate on fsverity file will succeed, what this check is trying to prevent.

Fixes e9734653c523 ("fs,fsverity: reject size changes on fsverity files in setattr_prepare")

---

Notes:
I rephrased commit messages a bit to be more clear.

 fs/attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/attr.c +1 -1
index 4f437fabb7f0..71888ac903c2 100644
@@ -176,7 +176,7 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
 		 * 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))
+		if (IS_VERITY(inode))
 			return -EPERM;
 
 		error = inode_newsize_ok(inode, attr->ia_size);
Signature · 1 line
2.54.0
maintainer Applied
#1 lore raw

[+Cc [email protected]]

Quoted 33 lines · Andrey Albershteyn

The check that fs-verity is available in the kernel is not necessary here. Filesystems could have fsverity files even without fs-verity enabled. In that case, truncate on fsverity file will succeed, what this check is trying to prevent.

Fixes e9734653c523 ("fs,fsverity: reject size changes on fsverity files in setattr_prepare")

---

Notes:
I rephrased commit messages a bit to be more clear.

 fs/attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/attr.c +1 -1
index 4f437fabb7f0..71888ac903c2 100644
@@ -176,7 +176,7 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
 		 * 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))
+		if (IS_VERITY(inode))
 			return -EPERM;
 
 		error = inode_newsize_ok(inode, attr->ia_size);
Signature · 1 line
2.54.0

Applied to https://git.kernel.org/pub/scm/fs/fsverity/linux.git/log/?h=for-current

- Eric