summaryrefslogtreecommitdiff
path: root/fs/verity
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-16 13:00:36 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-16 13:00:36 -0800
commit45a43ac5acc90b8f4835eea92692f620e561a06b (patch)
tree254f816efd2f9ce1363509520921d7a88192ac56 /fs/verity
parent543b9b63394ee67ecf5298fe42cbe65b21a16eac (diff)
parentdedfae78f00960d703badc500422d10e1f12b2bc (diff)
downloadlinux-next-45a43ac5acc90b8f4835eea92692f620e561a06b.tar.gz
linux-next-45a43ac5acc90b8f4835eea92692f620e561a06b.zip
Merge tag 'vfs-7.0-rc1.misc.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull more misc vfs updates from Christian Brauner: "Features: - Optimize close_range() from O(range size) to O(active FDs) by using find_next_bit() on the open_fds bitmap instead of linearly scanning the entire requested range. This is a significant improvement for large-range close operations on sparse file descriptor tables. - Add FS_XFLAG_VERITY file attribute for fs-verity files, retrievable via FS_IOC_FSGETXATTR and file_getattr(). The flag is read-only. Add tracepoints for fs-verity enable and verify operations, replacing the previously removed debug printk's. - Prevent nfsd from exporting special kernel filesystems like pidfs and nsfs. These filesystems have custom ->open() and ->permission() export methods that are designed for open_by_handle_at(2) only and are incompatible with nfsd. Update the exportfs documentation accordingly. Fixes: - Fix KMSAN uninit-value in ovl_fill_real() where strcmp() was used on a non-null-terminated decrypted directory entry name from fscrypt. This triggered on encrypted lower layers when the decrypted name buffer contained uninitialized tail data. The fix also adds VFS-level name_is_dot(), name_is_dotdot(), and name_is_dot_dotdot() helpers, replacing various open-coded "." and ".." checks across the tree. - Fix read-only fsflags not being reset together with xflags in vfs_fileattr_set(). Currently harmless since no read-only xflags overlap with flags, but this would cause inconsistencies for any future shared read-only flag - Return -EREMOTE instead of -ESRCH from PIDFD_GET_INFO when the target process is in a different pid namespace. This lets userspace distinguish "process exited" from "process in another namespace", matching glibc's pidfd_getpid() behavior Cleanups: - Use C-string literals in the Rust seq_file bindings, replacing the kernel::c_str!() macro (available since Rust 1.77) - Fix typo in d_walk_ret enum comment, add porting notes for the readlink_copy() calling convention change" * tag 'vfs-7.0-rc1.misc.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: fs: add porting notes about readlink_copy() pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns nfsd: do not allow exporting of special kernel filesystems exportfs: clarify the documentation of open()/permission() expotrfs ops fsverity: add tracepoints fs: add FS_XFLAG_VERITY for fs-verity files rust: seq_file: replace `kernel::c_str!` with C-Strings fs: dcache: fix typo in enum d_walk_ret comment ovl: use name_is_dot* helpers in readdir code fs: add helpers name_is_dot{,dot,_dotdot} ovl: Fix uninit-value in ovl_fill_real fs: reset read-only fsflags together with xflags fs/file: optimize close_range() complexity from O(N) to O(Sparse)
Diffstat (limited to 'fs/verity')
-rw-r--r--fs/verity/enable.c4
-rw-r--r--fs/verity/fsverity_private.h2
-rw-r--r--fs/verity/init.c1
-rw-r--r--fs/verity/verify.c9
4 files changed, 16 insertions, 0 deletions
diff --git a/fs/verity/enable.c b/fs/verity/enable.c
index c9448074cce1..42dfed1ce0ce 100644
--- a/fs/verity/enable.c
+++ b/fs/verity/enable.c
@@ -223,6 +223,8 @@ static int enable_verity(struct file *filp,
if (err)
goto out;
+ trace_fsverity_enable(inode, &params);
+
/*
* Start enabling verity on this file, serialized by the inode lock.
* Fail if verity is already enabled or is already being enabled.
@@ -265,6 +267,8 @@ static int enable_verity(struct file *filp,
goto rollback;
}
+ trace_fsverity_tree_done(inode, vi, &params);
+
/*
* Add the fsverity_info into the hash table before finishing the
* initialization so that we don't have to undo the enabling when memory
diff --git a/fs/verity/fsverity_private.h b/fs/verity/fsverity_private.h
index 2887cb849cec..6e6854c19078 100644
--- a/fs/verity/fsverity_private.h
+++ b/fs/verity/fsverity_private.h
@@ -163,4 +163,6 @@ static inline void fsverity_init_signature(void)
void __init fsverity_init_workqueue(void);
+#include <trace/events/fsverity.h>
+
#endif /* _FSVERITY_PRIVATE_H */
diff --git a/fs/verity/init.c b/fs/verity/init.c
index 6e8d33b50240..d65206608583 100644
--- a/fs/verity/init.c
+++ b/fs/verity/init.c
@@ -5,6 +5,7 @@
* Copyright 2019 Google LLC
*/
+#define CREATE_TRACE_POINTS
#include "fsverity_private.h"
#include <linux/ratelimit.h>
diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index 31797f9b24d0..404ab68aaf9b 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -177,6 +177,9 @@ static bool verify_data_block(struct fsverity_info *vi,
/* Byte offset of the wanted hash relative to @addr */
unsigned int hoffset;
} hblocks[FS_VERITY_MAX_LEVELS];
+
+ trace_fsverity_verify_data_block(inode, params, data_pos);
+
/*
* The index of the previous level's block within that level; also the
* index of that block's hash within the current level.
@@ -255,6 +258,9 @@ static bool verify_data_block(struct fsverity_info *vi,
want_hash = _want_hash;
kunmap_local(haddr);
put_page(hpage);
+ trace_fsverity_merkle_hit(inode, data_pos, hblock_idx,
+ level,
+ hoffset >> params->log_digestsize);
goto descend;
}
hblocks[level].page = hpage;
@@ -273,6 +279,9 @@ descend:
unsigned long hblock_idx = hblocks[level - 1].index;
unsigned int hoffset = hblocks[level - 1].hoffset;
+ trace_fsverity_verify_merkle_block(inode, hblock_idx,
+ level, hoffset >> params->log_digestsize);
+
fsverity_hash_block(params, haddr, real_hash);
if (memcmp(want_hash, real_hash, hsize) != 0)
goto corrupted;