Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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)

+274 -57
+16
Documentation/filesystems/fsverity.rst
··· 341 341 FS_IOC_GETFLAGS and FS_IOC_MEASURE_VERITY because it doesn't require 342 342 opening the file, and opening verity files can be expensive. 343 343 344 + FS_IOC_FSGETXATTR 345 + ----------------- 346 + 347 + Since Linux v7.0, the FS_IOC_FSGETXATTR ioctl sets FS_XFLAG_VERITY (0x00020000) 348 + in the returned flags when the file has verity enabled. Note that this attribute 349 + cannot be set with FS_IOC_FSSETXATTR as enabling verity requires input 350 + parameters. See FS_IOC_ENABLE_VERITY. 351 + 352 + file_getattr 353 + ------------ 354 + 355 + Since Linux v7.0, the file_getattr() syscall sets FS_XFLAG_VERITY (0x00020000) 356 + in the returned flags when the file has verity enabled. Note that this attribute 357 + cannot be set with file_setattr() as enabling verity requires input parameters. 358 + See FS_IOC_ENABLE_VERITY. 359 + 344 360 .. _accessing_verity_files: 345 361 346 362 Accessing verity files
+10
Documentation/filesystems/porting.rst
··· 1351 1351 (filename_renameat2(), etc.) 1352 1352 Callers are adjusted - responsibility for dropping the filenames belongs 1353 1353 to them now. 1354 + 1355 + --- 1356 + 1357 + **mandatory** 1358 + 1359 + readlink_copy() now requires link length as the 4th argument. Said length needs 1360 + to match what strlen() would return if it was ran on the string. 1361 + 1362 + However, if the string is freely accessible for the duration of inode's 1363 + lifetime, consider using inode_set_cached_link() instead.
+1
MAINTAINERS
··· 10415 10415 F: Documentation/filesystems/fsverity.rst 10416 10416 F: fs/verity/ 10417 10417 F: include/linux/fsverity.h 10418 + F: include/trace/events/fsverity.h 10418 10419 F: include/uapi/linux/fsverity.h 10419 10420 10420 10421 FT260 FTDI USB-HID TO I2C BRIDGE DRIVER
+1 -1
fs/crypto/fname.c
··· 76 76 77 77 static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) 78 78 { 79 - return is_dot_dotdot(str->name, str->len); 79 + return name_is_dot_dotdot(str->name, str->len); 80 80 } 81 81 82 82 /**
+5 -5
fs/dcache.c
··· 1298 1298 EXPORT_SYMBOL(shrink_dcache_sb); 1299 1299 1300 1300 /** 1301 - * enum d_walk_ret - action to talke during tree walk 1302 - * @D_WALK_CONTINUE: contrinue walk 1301 + * enum d_walk_ret - action to take during tree walk 1302 + * @D_WALK_CONTINUE: continue walk 1303 1303 * @D_WALK_QUIT: quit walk 1304 1304 * @D_WALK_NORETRY: quit when retry is needed 1305 1305 * @D_WALK_SKIP: skip this dentry and its children ··· 1722 1722 EXPORT_SYMBOL(d_invalidate); 1723 1723 1724 1724 /** 1725 - * __d_alloc - allocate a dcache entry 1725 + * __d_alloc - allocate a dcache entry 1726 1726 * @sb: filesystem it will belong to 1727 1727 * @name: qstr of the name 1728 1728 * ··· 1806 1806 } 1807 1807 1808 1808 /** 1809 - * d_alloc - allocate a dcache entry 1809 + * d_alloc - allocate a dcache entry 1810 1810 * @parent: parent of entry to allocate 1811 1811 * @name: qstr of the name 1812 1812 * ··· 2546 2546 } 2547 2547 2548 2548 /** 2549 - * d_rehash - add an entry back to the hash 2549 + * d_rehash - add an entry back to the hash 2550 2550 * @entry: dentry to add to the hash 2551 2551 * 2552 2552 * Adds a dentry to the hash according to its name.
+1 -1
fs/ecryptfs/crypto.c
··· 1904 1904 1905 1905 if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) && 1906 1906 !(mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)) { 1907 - if (is_dot_dotdot(name, name_size)) { 1907 + if (name_is_dot_dotdot(name, name_size)) { 1908 1908 rc = ecryptfs_copy_filename(plaintext_name, 1909 1909 plaintext_name_size, 1910 1910 name, name_size);
+2 -1
fs/exportfs/expfs.c
··· 253 253 container_of(ctx, struct getdents_callback, ctx); 254 254 255 255 buf->sequence++; 256 - if (buf->ino == ino && len <= NAME_MAX && !is_dot_dotdot(name, len)) { 256 + if (buf->ino == ino && len <= NAME_MAX && 257 + !name_is_dot_dotdot(name, len)) { 257 258 memcpy(buf->name, name, len); 258 259 buf->name[len] = '\0'; 259 260 buf->found = 1;
+1 -1
fs/f2fs/dir.c
··· 68 68 int len; 69 69 70 70 if (IS_CASEFOLDED(dir) && 71 - !is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) { 71 + !name_is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) { 72 72 buf = f2fs_kmem_cache_alloc(f2fs_cf_name_slab, 73 73 GFP_NOFS, false, F2FS_SB(sb)); 74 74 if (!buf)
+1 -1
fs/f2fs/hash.c
··· 100 100 101 101 WARN_ON_ONCE(!name); 102 102 103 - if (is_dot_dotdot(name, len)) { 103 + if (name_is_dot_dotdot(name, len)) { 104 104 fname->hash = 0; 105 105 return; 106 106 }
+8 -2
fs/file.c
··· 777 777 unsigned int max_fd) 778 778 { 779 779 struct file *file; 780 + struct fdtable *fdt; 780 781 unsigned n; 781 782 782 783 spin_lock(&files->file_lock); 783 - n = last_fd(files_fdtable(files)); 784 + fdt = files_fdtable(files); 785 + n = last_fd(fdt); 784 786 max_fd = min(max_fd, n); 785 787 786 - for (; fd <= max_fd; fd++) { 788 + for (fd = find_next_bit(fdt->open_fds, max_fd + 1, fd); 789 + fd <= max_fd; 790 + fd = find_next_bit(fdt->open_fds, max_fd + 1, fd + 1)) { 787 791 file = file_close_fd_locked(files, fd); 788 792 if (file) { 789 793 spin_unlock(&files->file_lock); 790 794 filp_close(file, files); 791 795 cond_resched(); 792 796 spin_lock(&files->file_lock); 797 + fdt = files_fdtable(files); 793 798 } else if (need_resched()) { 794 799 spin_unlock(&files->file_lock); 795 800 cond_resched(); 796 801 spin_lock(&files->file_lock); 802 + fdt = files_fdtable(files); 797 803 } 798 804 } 799 805 spin_unlock(&files->file_lock);
+6 -4
fs/file_attr.c
··· 37 37 fa->flags |= FS_DAX_FL; 38 38 if (fa->fsx_xflags & FS_XFLAG_PROJINHERIT) 39 39 fa->flags |= FS_PROJINHERIT_FL; 40 + if (fa->fsx_xflags & FS_XFLAG_VERITY) 41 + fa->flags |= FS_VERITY_FL; 40 42 } 41 43 EXPORT_SYMBOL(fileattr_fill_xflags); 42 44 ··· 69 67 fa->fsx_xflags |= FS_XFLAG_DAX; 70 68 if (fa->flags & FS_PROJINHERIT_FL) 71 69 fa->fsx_xflags |= FS_XFLAG_PROJINHERIT; 70 + if (fa->flags & FS_VERITY_FL) 71 + fa->fsx_xflags |= FS_XFLAG_VERITY; 72 72 } 73 73 EXPORT_SYMBOL(fileattr_fill_flags); 74 74 ··· 146 142 if (fattr->fa_xflags & ~mask) 147 143 return -EINVAL; 148 144 149 - fileattr_fill_xflags(fa, fattr->fa_xflags); 150 - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK; 145 + fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK); 151 146 fa->fsx_extsize = fattr->fa_extsize; 152 147 fa->fsx_projid = fattr->fa_projid; 153 148 fa->fsx_cowextsize = fattr->fa_cowextsize; ··· 166 163 if (xfa.fsx_xflags & ~mask) 167 164 return -EOPNOTSUPP; 168 165 169 - fileattr_fill_xflags(fa, xfa.fsx_xflags); 170 - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK; 166 + fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK); 171 167 fa->fsx_extsize = xfa.fsx_extsize; 172 168 fa->fsx_nextents = xfa.fsx_nextents; 173 169 fa->fsx_projid = xfa.fsx_projid;
+1 -1
fs/namei.c
··· 3088 3088 if (!len) 3089 3089 return -EACCES; 3090 3090 3091 - if (is_dot_dotdot(name, len)) 3091 + if (name_is_dot_dotdot(name, len)) 3092 3092 return -EACCES; 3093 3093 3094 3094 while (len--) {
+5 -3
fs/nfsd/export.c
··· 427 427 * either a device number (so FS_REQUIRES_DEV needed) 428 428 * or an FSID number (so NFSEXP_FSID or ->uuid is needed). 429 429 * 2: We must be able to find an inode from a filehandle. 430 - * This means that s_export_op must be set. 430 + * This means that s_export_op must be set and comply with 431 + * the requirements for remote filesystem export. 431 432 * 3: We must not currently be on an idmapped mount. 432 433 */ 433 434 if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && ··· 438 437 return -EINVAL; 439 438 } 440 439 441 - if (!exportfs_can_decode_fh(inode->i_sb->s_export_op)) { 442 - dprintk("exp_export: export of invalid fs type.\n"); 440 + if (!exportfs_may_export(inode->i_sb->s_export_op)) { 441 + dprintk("exp_export: export of invalid fs type (%s).\n", 442 + inode->i_sb->s_type->name); 443 443 return -EINVAL; 444 444 } 445 445
+15 -26
fs/overlayfs/readdir.c
··· 77 77 char *cf_name; 78 78 int cf_len; 79 79 80 - if (!IS_ENABLED(CONFIG_UNICODE) || !rdd->map || is_dot_dotdot(str, len)) 80 + if (!IS_ENABLED(CONFIG_UNICODE) || !rdd->map || 81 + name_is_dot_dotdot(str, len)) 81 82 return 0; 82 83 83 84 cf_name = kmalloc(NAME_MAX, GFP_KERNEL); ··· 155 154 return true; 156 155 157 156 /* Always recalc d_ino for parent */ 158 - if (strcmp(p->name, "..") == 0) 157 + if (name_is_dotdot(p->name, p->len)) 159 158 return true; 160 159 161 160 /* If this is lower, then native d_ino will do */ ··· 166 165 * Recalc d_ino for '.' and for all entries if dir is impure (contains 167 166 * copied up entries) 168 167 */ 169 - if ((p->name[0] == '.' && p->len == 1) || 168 + if (name_is_dot(p->name, p->len) || 170 169 ovl_test_flag(OVL_IMPURE, d_inode(rdd->dentry))) 171 170 return true; 172 171 ··· 562 561 if (!ovl_same_dev(ofs) && !p->check_xwhiteout) 563 562 goto out; 564 563 565 - if (p->name[0] == '.') { 564 + if (name_is_dot_dotdot(p->name, p->len)) { 566 565 if (p->len == 1) { 567 566 this = dget(dir); 568 567 goto get; 569 568 } 570 - if (p->len == 2 && p->name[1] == '.') { 569 + if (p->len == 2) { 571 570 /* we shall not be moved */ 572 571 this = dget(dir->d_parent); 573 572 goto get; ··· 667 666 return err; 668 667 669 668 list_for_each_entry_safe(p, n, list, l_node) { 670 - if (strcmp(p->name, ".") != 0 && 671 - strcmp(p->name, "..") != 0) { 669 + if (!name_is_dot_dotdot(p->name, p->len)) { 672 670 err = ovl_cache_update(path, p, true); 673 671 if (err) 674 672 return err; ··· 756 756 struct dir_context *orig_ctx = rdt->orig_ctx; 757 757 bool res; 758 758 759 - if (rdt->parent_ino && strcmp(name, "..") == 0) { 759 + if (rdt->parent_ino && name_is_dotdot(name, namelen)) { 760 760 ino = rdt->parent_ino; 761 761 } else if (rdt->cache) { 762 762 struct ovl_cache_entry *p; ··· 1098 1098 goto del_entry; 1099 1099 } 1100 1100 1101 - if (p->name[0] == '.') { 1102 - if (p->len == 1) 1103 - goto del_entry; 1104 - if (p->len == 2 && p->name[1] == '.') 1105 - goto del_entry; 1106 - } 1101 + if (name_is_dot_dotdot(p->name, p->len)) 1102 + goto del_entry; 1107 1103 err = -ENOTEMPTY; 1108 1104 break; 1109 1105 ··· 1143 1147 container_of(ctx, struct ovl_readdir_data, ctx); 1144 1148 1145 1149 /* Even if d_type is not supported, DT_DIR is returned for . and .. */ 1146 - if (!strncmp(name, ".", namelen) || !strncmp(name, "..", namelen)) 1150 + if (name_is_dot_dotdot(name, namelen)) 1147 1151 return true; 1148 1152 1149 1153 if (d_type != DT_UNKNOWN) ··· 1206 1210 list_for_each_entry(p, &list, l_node) { 1207 1211 struct dentry *dentry; 1208 1212 1209 - if (p->name[0] == '.') { 1210 - if (p->len == 1) 1211 - continue; 1212 - if (p->len == 2 && p->name[1] == '.') 1213 - continue; 1213 + if (name_is_dot_dotdot(p->name, p->len)) { 1214 + continue; 1214 1215 } else if (incompat) { 1215 1216 pr_err("overlay with incompat feature '%s' cannot be mounted\n", 1216 1217 p->name); ··· 1272 1279 goto out; 1273 1280 1274 1281 list_for_each_entry(p, &list, l_node) { 1275 - if (p->name[0] == '.') { 1276 - if (p->len == 1) 1277 - continue; 1278 - if (p->len == 2 && p->name[1] == '.') 1279 - continue; 1280 - } 1282 + if (name_is_dot_dotdot(p->name, p->len)) 1283 + continue; 1281 1284 index = ovl_lookup_upper_unlocked(ofs, p->name, indexdir, p->len); 1282 1285 if (IS_ERR(index)) { 1283 1286 err = PTR_ERR(index);
+1 -1
fs/pidfs.c
··· 360 360 * namespace hierarchy. 361 361 */ 362 362 if (!pid_in_current_pidns(pid)) 363 - return -ESRCH; 363 + return -EREMOTE; 364 364 365 365 attr = READ_ONCE(pid->attr); 366 366 if (mask & PIDFD_INFO_EXIT) {
+1 -1
fs/smb/server/vfs.c
··· 1044 1044 struct ksmbd_readdir_data *buf; 1045 1045 1046 1046 buf = container_of(ctx, struct ksmbd_readdir_data, ctx); 1047 - if (!is_dot_dotdot(name, namlen)) 1047 + if (!name_is_dot_dotdot(name, namlen)) 1048 1048 buf->dirent_count++; 1049 1049 1050 1050 return !buf->dirent_count;
+4
fs/verity/enable.c
··· 223 223 if (err) 224 224 goto out; 225 225 226 + trace_fsverity_enable(inode, &params); 227 + 226 228 /* 227 229 * Start enabling verity on this file, serialized by the inode lock. 228 230 * Fail if verity is already enabled or is already being enabled. ··· 266 264 err = PTR_ERR(vi); 267 265 goto rollback; 268 266 } 267 + 268 + trace_fsverity_tree_done(inode, vi, &params); 269 269 270 270 /* 271 271 * Add the fsverity_info into the hash table before finishing the
+2
fs/verity/fsverity_private.h
··· 163 163 164 164 void __init fsverity_init_workqueue(void); 165 165 166 + #include <trace/events/fsverity.h> 167 + 166 168 #endif /* _FSVERITY_PRIVATE_H */
+1
fs/verity/init.c
··· 5 5 * Copyright 2019 Google LLC 6 6 */ 7 7 8 + #define CREATE_TRACE_POINTS 8 9 #include "fsverity_private.h" 9 10 10 11 #include <linux/ratelimit.h>
+9
fs/verity/verify.c
··· 177 177 /* Byte offset of the wanted hash relative to @addr */ 178 178 unsigned int hoffset; 179 179 } hblocks[FS_VERITY_MAX_LEVELS]; 180 + 181 + trace_fsverity_verify_data_block(inode, params, data_pos); 182 + 180 183 /* 181 184 * The index of the previous level's block within that level; also the 182 185 * index of that block's hash within the current level. ··· 258 255 want_hash = _want_hash; 259 256 kunmap_local(haddr); 260 257 put_page(hpage); 258 + trace_fsverity_merkle_hit(inode, data_pos, hblock_idx, 259 + level, 260 + hoffset >> params->log_digestsize); 261 261 goto descend; 262 262 } 263 263 hblocks[level].page = hpage; ··· 278 272 const void *haddr = hblocks[level - 1].addr; 279 273 unsigned long hblock_idx = hblocks[level - 1].index; 280 274 unsigned int hoffset = hblocks[level - 1].hoffset; 275 + 276 + trace_fsverity_verify_merkle_block(inode, hblock_idx, 277 + level, hoffset >> params->log_digestsize); 281 278 282 279 fsverity_hash_block(params, haddr, real_hash); 283 280 if (memcmp(want_hash, real_hash, hsize) != 0)
+19 -2
include/linux/exportfs.h
··· 200 200 * @get_parent: find the parent of a given directory 201 201 * @commit_metadata: commit metadata changes to stable storage 202 202 * 203 + * Methods for open_by_handle(2) syscall with special kernel file systems: 204 + * @permission: custom permission for opening a file by handle 205 + * @open: custom open routine for opening file by handle 206 + * 203 207 * See Documentation/filesystems/nfs/exporting.rst for details on how to use 204 208 * this interface correctly and the definition of the flags. 205 209 * ··· 248 244 * space cannot be allocated, a %ERR_PTR should be returned. 249 245 * 250 246 * @permission: 251 - * Allow filesystems to specify a custom permission function. 247 + * Allow filesystems to specify a custom permission function for the 248 + * open_by_handle_at(2) syscall instead of the default permission check. 249 + * This custom permission function is not respected by nfsd. 252 250 * 253 251 * @open: 254 - * Allow filesystems to specify a custom open function. 252 + * Allow filesystems to specify a custom open function for the 253 + * open_by_handle_at(2) syscall instead of the default file_open_root(). 254 + * This custom open function is not respected by nfsd. 255 255 * 256 256 * @commit_metadata: 257 257 * @commit_metadata should commit metadata changes to stable storage. ··· 336 328 static inline bool exportfs_can_decode_fh(const struct export_operations *nop) 337 329 { 338 330 return nop && nop->fh_to_dentry; 331 + } 332 + 333 + static inline bool exportfs_may_export(const struct export_operations *nop) 334 + { 335 + /* 336 + * Do not allow nfs export for filesystems with custom ->open() or 337 + * ->permission() ops, which nfsd does not respect (e.g. pidfs, nsfs). 338 + */ 339 + return exportfs_can_decode_fh(nop) && !nop->open && !nop->permission; 339 340 } 340 341 341 342 static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
+3 -3
include/linux/fileattr.h
··· 7 7 #define FS_COMMON_FL \ 8 8 (FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \ 9 9 FS_NODUMP_FL | FS_NOATIME_FL | FS_DAX_FL | \ 10 - FS_PROJINHERIT_FL) 10 + FS_PROJINHERIT_FL | FS_VERITY_FL) 11 11 12 12 #define FS_XFLAG_COMMON \ 13 13 (FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \ 14 14 FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \ 15 - FS_XFLAG_PROJINHERIT) 15 + FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY) 16 16 17 17 /* Read-only inode flags */ 18 18 #define FS_XFLAG_RDONLY_MASK \ 19 - (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR) 19 + (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY) 20 20 21 21 /* Flags to indicate valid value of fsx_ fields */ 22 22 #define FS_XFLAG_VALUES_MASK \
+12 -2
include/linux/fs.h
··· 2872 2872 2873 2873 extern char *file_path(struct file *, char *, int); 2874 2874 2875 + static inline bool name_is_dot(const char *name, size_t len) 2876 + { 2877 + return unlikely(len == 1 && name[0] == '.'); 2878 + } 2879 + 2880 + static inline bool name_is_dotdot(const char *name, size_t len) 2881 + { 2882 + return unlikely(len == 2 && name[0] == '.' && name[1] == '.'); 2883 + } 2884 + 2875 2885 /** 2876 - * is_dot_dotdot - returns true only if @name is "." or ".." 2886 + * name_is_dot_dotdot - returns true only if @name is "." or ".." 2877 2887 * @name: file name to check 2878 2888 * @len: length of file name, in bytes 2879 2889 */ 2880 - static inline bool is_dot_dotdot(const char *name, size_t len) 2890 + static inline bool name_is_dot_dotdot(const char *name, size_t len) 2881 2891 { 2882 2892 return len && unlikely(name[0] == '.') && 2883 2893 (len == 1 || (len == 2 && name[1] == '.'));
+146
include/trace/events/fsverity.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #undef TRACE_SYSTEM 3 + #define TRACE_SYSTEM fsverity 4 + 5 + #if !defined(_TRACE_FSVERITY_H) || defined(TRACE_HEADER_MULTI_READ) 6 + #define _TRACE_FSVERITY_H 7 + 8 + #include <linux/tracepoint.h> 9 + 10 + struct fsverity_descriptor; 11 + struct merkle_tree_params; 12 + struct fsverity_info; 13 + 14 + TRACE_EVENT(fsverity_enable, 15 + TP_PROTO(const struct inode *inode, 16 + const struct merkle_tree_params *params), 17 + TP_ARGS(inode, params), 18 + TP_STRUCT__entry( 19 + __field(ino_t, ino) 20 + __field(u64, data_size) 21 + __field(u64, tree_size) 22 + __field(unsigned int, merkle_block) 23 + __field(unsigned int, num_levels) 24 + ), 25 + TP_fast_assign( 26 + __entry->ino = inode->i_ino; 27 + __entry->data_size = i_size_read(inode); 28 + __entry->tree_size = params->tree_size; 29 + __entry->merkle_block = params->block_size; 30 + __entry->num_levels = params->num_levels; 31 + ), 32 + TP_printk("ino %lu data_size %llu tree_size %llu merkle_block %u levels %u", 33 + (unsigned long) __entry->ino, 34 + __entry->data_size, 35 + __entry->tree_size, 36 + __entry->merkle_block, 37 + __entry->num_levels) 38 + ); 39 + 40 + TRACE_EVENT(fsverity_tree_done, 41 + TP_PROTO(const struct inode *inode, const struct fsverity_info *vi, 42 + const struct merkle_tree_params *params), 43 + TP_ARGS(inode, vi, params), 44 + TP_STRUCT__entry( 45 + __field(ino_t, ino) 46 + __field(u64, data_size) 47 + __field(u64, tree_size) 48 + __field(unsigned int, merkle_block) 49 + __field(unsigned int, levels) 50 + __dynamic_array(u8, root_hash, params->digest_size) 51 + __dynamic_array(u8, file_digest, params->digest_size) 52 + ), 53 + TP_fast_assign( 54 + __entry->ino = inode->i_ino; 55 + __entry->data_size = i_size_read(inode); 56 + __entry->tree_size = params->tree_size; 57 + __entry->merkle_block = params->block_size; 58 + __entry->levels = params->num_levels; 59 + memcpy(__get_dynamic_array(root_hash), vi->root_hash, __get_dynamic_array_len(root_hash)); 60 + memcpy(__get_dynamic_array(file_digest), vi->file_digest, __get_dynamic_array_len(file_digest)); 61 + ), 62 + TP_printk("ino %lu data_size %llu tree_size %lld merkle_block %u levels %u root_hash %s digest %s", 63 + (unsigned long) __entry->ino, 64 + __entry->data_size, 65 + __entry->tree_size, 66 + __entry->merkle_block, 67 + __entry->levels, 68 + __print_hex_str(__get_dynamic_array(root_hash), __get_dynamic_array_len(root_hash)), 69 + __print_hex_str(__get_dynamic_array(file_digest), __get_dynamic_array_len(file_digest))) 70 + ); 71 + 72 + TRACE_EVENT(fsverity_verify_data_block, 73 + TP_PROTO(const struct inode *inode, 74 + const struct merkle_tree_params *params, 75 + u64 data_pos), 76 + TP_ARGS(inode, params, data_pos), 77 + TP_STRUCT__entry( 78 + __field(ino_t, ino) 79 + __field(u64, data_pos) 80 + __field(unsigned int, merkle_block) 81 + ), 82 + TP_fast_assign( 83 + __entry->ino = inode->i_ino; 84 + __entry->data_pos = data_pos; 85 + __entry->merkle_block = params->block_size; 86 + ), 87 + TP_printk("ino %lu data_pos %llu merkle_block %u", 88 + (unsigned long) __entry->ino, 89 + __entry->data_pos, 90 + __entry->merkle_block) 91 + ); 92 + 93 + TRACE_EVENT(fsverity_merkle_hit, 94 + TP_PROTO(const struct inode *inode, u64 data_pos, 95 + unsigned long hblock_idx, unsigned int level, 96 + unsigned int hidx), 97 + TP_ARGS(inode, data_pos, hblock_idx, level, hidx), 98 + TP_STRUCT__entry( 99 + __field(ino_t, ino) 100 + __field(u64, data_pos) 101 + __field(unsigned long, hblock_idx) 102 + __field(unsigned int, level) 103 + __field(unsigned int, hidx) 104 + ), 105 + TP_fast_assign( 106 + __entry->ino = inode->i_ino; 107 + __entry->data_pos = data_pos; 108 + __entry->hblock_idx = hblock_idx; 109 + __entry->level = level; 110 + __entry->hidx = hidx; 111 + ), 112 + TP_printk("ino %lu data_pos %llu hblock_idx %lu level %u hidx %u", 113 + (unsigned long) __entry->ino, 114 + __entry->data_pos, 115 + __entry->hblock_idx, 116 + __entry->level, 117 + __entry->hidx) 118 + ); 119 + 120 + TRACE_EVENT(fsverity_verify_merkle_block, 121 + TP_PROTO(const struct inode *inode, unsigned long hblock_idx, 122 + unsigned int level, unsigned int hidx), 123 + TP_ARGS(inode, hblock_idx, level, hidx), 124 + TP_STRUCT__entry( 125 + __field(ino_t, ino) 126 + __field(unsigned long, hblock_idx) 127 + __field(unsigned int, level) 128 + __field(unsigned int, hidx) 129 + ), 130 + TP_fast_assign( 131 + __entry->ino = inode->i_ino; 132 + __entry->hblock_idx = hblock_idx; 133 + __entry->level = level; 134 + __entry->hidx = hidx; 135 + ), 136 + TP_printk("ino %lu hblock_idx %lu level %u hidx %u", 137 + (unsigned long) __entry->ino, 138 + __entry->hblock_idx, 139 + __entry->level, 140 + __entry->hidx) 141 + ); 142 + 143 + #endif /* _TRACE_FSVERITY_H */ 144 + 145 + /* This part must be outside protection */ 146 + #include <trace/define_trace.h>
+1
include/uapi/linux/fs.h
··· 253 253 #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ 254 254 #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ 255 255 #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ 256 + #define FS_XFLAG_VERITY 0x00020000 /* fs-verity enabled */ 256 257 #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ 257 258 258 259 /* the read-only stuff doesn't really belong here, but any other place is
+2 -2
rust/kernel/seq_file.rs
··· 4 4 //! 5 5 //! C header: [`include/linux/seq_file.h`](srctree/include/linux/seq_file.h) 6 6 7 - use crate::{bindings, c_str, fmt, str::CStrExt as _, types::NotThreadSafe, types::Opaque}; 7 + use crate::{bindings, fmt, str::CStrExt as _, types::NotThreadSafe, types::Opaque}; 8 8 9 9 /// A utility for generating the contents of a seq file. 10 10 #[repr(transparent)] ··· 36 36 unsafe { 37 37 bindings::seq_printf( 38 38 self.inner.get(), 39 - c_str!("%pA").as_char_ptr(), 39 + c"%pA".as_char_ptr(), 40 40 core::ptr::from_ref(&args).cast::<crate::ffi::c_void>(), 41 41 ); 42 42 }