Merge tag 'vfs-6.15-rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs fixes from Christian Brauner:

- Add a new maintainer for configfs

- Fix exportfs module description

- Place flexible array memeber at the end of an internal struct in the
mount code

- Add new maintainer for netfslib as Jeff Layton is stepping down as
current co-maintainer

- Fix error handling in cachefiles_get_directory()

- Cleanup do_notify_pidfd()

- Fix syscall number definitions in pidfd selftests

- Fix racy usage of fs_struct->in exec during multi-threaded exec

- Ensure correct exit code is reported when pidfs_exit() is called from
release_task() for a delayed thread-group leader exit

- Fix conflicting iomap flag definitions

* tag 'vfs-6.15-rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
iomap: Fix conflicting values of iomap flags
fs: namespace: Avoid -Wflex-array-member-not-at-end warning
MAINTAINERS: configfs: add Andreas Hindborg as maintainer
exportfs: add module description
exit: fix the usage of delay_group_leader->exit_code in do_notify_parent() and pidfs_exit()
netfs: add Paulo as maintainer and remove myself as Reviewer
cachefiles: Fix oops in vfs_mkdir from cachefiles_get_directory
exec: fix the racy usage of fs_struct->in_exec
selftests/pidfd: fixes syscall number defines
pidfs: cleanup the usage of do_notify_pidfd()

+45 -37
+4
CREDITS
··· 317 S: Greenbelt, Maryland 20771 318 S: USA 319 320 N: Adam Belay 321 E: ambx1@neo.rr.com 322 D: Linux Plug and Play Support
··· 317 S: Greenbelt, Maryland 20771 318 S: USA 319 320 + N: Joel Becker 321 + E: jlbec@evilplan.org 322 + D: configfs 323 + 324 N: Adam Belay 325 E: ambx1@neo.rr.com 326 D: Linux Plug and Play Support
+4 -3
MAINTAINERS
··· 5967 F: Documentation/security/snp-tdx-threat-model.rst 5968 5969 CONFIGFS 5970 - M: Joel Becker <jlbec@evilplan.org> 5971 S: Supported 5972 - T: git git://git.infradead.org/users/hch/configfs.git 5973 F: fs/configfs/ 5974 F: include/linux/configfs.h 5975 F: samples/configfs/ ··· 9107 9108 FILESYSTEMS [NETFS LIBRARY] 9109 M: David Howells <dhowells@redhat.com> 9110 - R: Jeff Layton <jlayton@kernel.org> 9111 L: netfs@lists.linux.dev 9112 L: linux-fsdevel@vger.kernel.org 9113 S: Supported
··· 5967 F: Documentation/security/snp-tdx-threat-model.rst 5968 5969 CONFIGFS 5970 + M: Andreas Hindborg <a.hindborg@kernel.org> 5971 + R: Breno Leitao <leitao@debian.org> 5972 S: Supported 5973 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux.git configfs-next 5974 F: fs/configfs/ 5975 F: include/linux/configfs.h 5976 F: samples/configfs/ ··· 9106 9107 FILESYSTEMS [NETFS LIBRARY] 9108 M: David Howells <dhowells@redhat.com> 9109 + M: Paulo Alcantara <pc@manguebit.com> 9110 L: netfs@lists.linux.dev 9111 L: linux-fsdevel@vger.kernel.org 9112 S: Supported
+4 -3
fs/cachefiles/namei.c
··· 128 ret = security_path_mkdir(&path, subdir, 0700); 129 if (ret < 0) 130 goto mkdir_error; 131 - subdir = ERR_PTR(cachefiles_inject_write_error()); 132 - if (!IS_ERR(subdir)) 133 subdir = vfs_mkdir(&nop_mnt_idmap, d_inode(dir), subdir, 0700); 134 - ret = PTR_ERR(subdir); 135 if (IS_ERR(subdir)) { 136 trace_cachefiles_vfs_error(NULL, d_inode(dir), ret, 137 cachefiles_trace_mkdir_error);
··· 128 ret = security_path_mkdir(&path, subdir, 0700); 129 if (ret < 0) 130 goto mkdir_error; 131 + ret = cachefiles_inject_write_error(); 132 + if (ret == 0) 133 subdir = vfs_mkdir(&nop_mnt_idmap, d_inode(dir), subdir, 0700); 134 + else 135 + subdir = ERR_PTR(ret); 136 if (IS_ERR(subdir)) { 137 trace_cachefiles_vfs_error(NULL, d_inode(dir), ret, 138 cachefiles_trace_mkdir_error);
+9 -6
fs/exec.c
··· 1227 */ 1228 bprm->point_of_no_return = true; 1229 1230 - /* 1231 - * Make this the only thread in the thread group. 1232 - */ 1233 retval = de_thread(me); 1234 if (retval) 1235 goto out; 1236 - 1237 /* 1238 * Cancel any io_uring activity across execve 1239 */ ··· 1494 } 1495 free_arg_pages(bprm); 1496 if (bprm->cred) { 1497 mutex_unlock(&current->signal->cred_guard_mutex); 1498 abort_creds(bprm->cred); 1499 } ··· 1617 * suid exec because the differently privileged task 1618 * will be able to manipulate the current directory, etc. 1619 * It would be nice to force an unshare instead... 1620 */ 1621 n_fs = 1; 1622 spin_lock(&p->fs->lock); ··· 1865 1866 sched_mm_cid_after_execve(current); 1867 /* execve succeeded */ 1868 - current->fs->in_exec = 0; 1869 current->in_execve = 0; 1870 rseq_execve(current); 1871 user_events_execve(current); ··· 1883 force_fatal_sig(SIGSEGV); 1884 1885 sched_mm_cid_after_execve(current); 1886 - current->fs->in_exec = 0; 1887 current->in_execve = 0; 1888 1889 return retval;
··· 1227 */ 1228 bprm->point_of_no_return = true; 1229 1230 + /* Make this the only thread in the thread group */ 1231 retval = de_thread(me); 1232 if (retval) 1233 goto out; 1234 + /* see the comment in check_unsafe_exec() */ 1235 + current->fs->in_exec = 0; 1236 /* 1237 * Cancel any io_uring activity across execve 1238 */ ··· 1495 } 1496 free_arg_pages(bprm); 1497 if (bprm->cred) { 1498 + /* in case exec fails before de_thread() succeeds */ 1499 + current->fs->in_exec = 0; 1500 mutex_unlock(&current->signal->cred_guard_mutex); 1501 abort_creds(bprm->cred); 1502 } ··· 1616 * suid exec because the differently privileged task 1617 * will be able to manipulate the current directory, etc. 1618 * It would be nice to force an unshare instead... 1619 + * 1620 + * Otherwise we set fs->in_exec = 1 to deny clone(CLONE_FS) 1621 + * from another sub-thread until de_thread() succeeds, this 1622 + * state is protected by cred_guard_mutex we hold. 1623 */ 1624 n_fs = 1; 1625 spin_lock(&p->fs->lock); ··· 1860 1861 sched_mm_cid_after_execve(current); 1862 /* execve succeeded */ 1863 current->in_execve = 0; 1864 rseq_execve(current); 1865 user_events_execve(current); ··· 1879 force_fatal_sig(SIGSEGV); 1880 1881 sched_mm_cid_after_execve(current); 1882 current->in_execve = 0; 1883 1884 return retval;
+1
fs/exportfs/expfs.c
··· 608 } 609 EXPORT_SYMBOL_GPL(exportfs_decode_fh); 610 611 MODULE_LICENSE("GPL");
··· 608 } 609 EXPORT_SYMBOL_GPL(exportfs_decode_fh); 610 611 + MODULE_DESCRIPTION("Code mapping from inodes to file handles"); 612 MODULE_LICENSE("GPL");
+3 -1
fs/namespace.c
··· 5326 struct mnt_idmap *idmap; 5327 u64 mask; 5328 struct path root; 5329 - struct statmount sm; 5330 struct seq_file seq; 5331 }; 5332 5333 static u64 mnt_to_attr_flags(struct vfsmount *mnt)
··· 5326 struct mnt_idmap *idmap; 5327 u64 mask; 5328 struct path root; 5329 struct seq_file seq; 5330 + 5331 + /* Must be last --ends in a flexible-array member. */ 5332 + struct statmount sm; 5333 }; 5334 5335 static u64 mnt_to_attr_flags(struct vfsmount *mnt)
+7 -8
include/linux/iomap.h
··· 79 #define IOMAP_F_ATOMIC_BIO (1U << 8) 80 81 /* 82 * Flags set by the core iomap code during operations: 83 * 84 * IOMAP_F_SIZE_CHANGED indicates to the iomap_end method that the file size ··· 93 * range it covers needs to be remapped by the high level before the operation 94 * can proceed. 95 */ 96 - #define IOMAP_F_SIZE_CHANGED (1U << 8) 97 - #define IOMAP_F_STALE (1U << 9) 98 - 99 - /* 100 - * Flags from 0x1000 up are for file system specific usage: 101 - */ 102 - #define IOMAP_F_PRIVATE (1U << 12) 103 - 104 105 /* 106 * Magic value for addr:
··· 79 #define IOMAP_F_ATOMIC_BIO (1U << 8) 80 81 /* 82 + * Flag reserved for file system specific usage 83 + */ 84 + #define IOMAP_F_PRIVATE (1U << 12) 85 + 86 + /* 87 * Flags set by the core iomap code during operations: 88 * 89 * IOMAP_F_SIZE_CHANGED indicates to the iomap_end method that the file size ··· 88 * range it covers needs to be remapped by the high level before the operation 89 * can proceed. 90 */ 91 + #define IOMAP_F_SIZE_CHANGED (1U << 14) 92 + #define IOMAP_F_STALE (1U << 15) 93 94 /* 95 * Magic value for addr:
+5 -6
kernel/exit.c
··· 268 leader = p->group_leader; 269 if (leader != p && thread_group_empty(leader) 270 && leader->exit_state == EXIT_ZOMBIE) { 271 /* 272 * If we were the last child thread and the leader has 273 * exited already, and the leader's parent ignores SIGCHLD, ··· 759 kill_orphaned_pgrp(tsk->group_leader, NULL); 760 761 tsk->exit_state = EXIT_ZOMBIE; 762 - /* 763 - * Ignore thread-group leaders that exited before all 764 - * subthreads did. 765 - */ 766 - if (!delay_group_leader(tsk)) 767 - do_notify_pidfd(tsk); 768 769 if (unlikely(tsk->ptrace)) { 770 int sig = thread_group_leader(tsk) && ··· 771 do_notify_parent(tsk, tsk->exit_signal); 772 } else { 773 autoreap = true; 774 } 775 776 if (autoreap) {
··· 268 leader = p->group_leader; 269 if (leader != p && thread_group_empty(leader) 270 && leader->exit_state == EXIT_ZOMBIE) { 271 + /* for pidfs_exit() and do_notify_parent() */ 272 + if (leader->signal->flags & SIGNAL_GROUP_EXIT) 273 + leader->exit_code = leader->signal->group_exit_code; 274 /* 275 * If we were the last child thread and the leader has 276 * exited already, and the leader's parent ignores SIGCHLD, ··· 756 kill_orphaned_pgrp(tsk->group_leader, NULL); 757 758 tsk->exit_state = EXIT_ZOMBIE; 759 760 if (unlikely(tsk->ptrace)) { 761 int sig = thread_group_leader(tsk) && ··· 774 do_notify_parent(tsk, tsk->exit_signal); 775 } else { 776 autoreap = true; 777 + /* untraced sub-thread */ 778 + do_notify_pidfd(tsk); 779 } 780 781 if (autoreap) {
+3 -5
kernel/signal.c
··· 2180 2181 WARN_ON_ONCE(!tsk->ptrace && 2182 (tsk->group_leader != tsk || !thread_group_empty(tsk))); 2183 - /* 2184 - * Notify for thread-group leaders without subthreads. 2185 - */ 2186 - if (thread_group_empty(tsk)) 2187 - do_notify_pidfd(tsk); 2188 2189 if (sig != SIGCHLD) { 2190 /*
··· 2180 2181 WARN_ON_ONCE(!tsk->ptrace && 2182 (tsk->group_leader != tsk || !thread_group_empty(tsk))); 2183 + 2184 + /* ptraced, or group-leader without sub-threads */ 2185 + do_notify_pidfd(tsk); 2186 2187 if (sig != SIGCHLD) { 2188 /*
+1 -1
tools/testing/selftests/clone3/clone3_selftests.h
··· 16 #define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr))) 17 18 #ifndef __NR_clone3 19 - #define __NR_clone3 -1 20 #endif 21 22 struct __clone_args {
··· 16 #define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr))) 17 18 #ifndef __NR_clone3 19 + #define __NR_clone3 435 20 #endif 21 22 struct __clone_args {
+4 -4
tools/testing/selftests/pidfd/pidfd.h
··· 32 #endif 33 34 #ifndef __NR_pidfd_open 35 - #define __NR_pidfd_open -1 36 #endif 37 38 #ifndef __NR_pidfd_send_signal 39 - #define __NR_pidfd_send_signal -1 40 #endif 41 42 #ifndef __NR_clone3 43 - #define __NR_clone3 -1 44 #endif 45 46 #ifndef __NR_pidfd_getfd 47 - #define __NR_pidfd_getfd -1 48 #endif 49 50 #ifndef PIDFD_NONBLOCK
··· 32 #endif 33 34 #ifndef __NR_pidfd_open 35 + #define __NR_pidfd_open 434 36 #endif 37 38 #ifndef __NR_pidfd_send_signal 39 + #define __NR_pidfd_send_signal 424 40 #endif 41 42 #ifndef __NR_clone3 43 + #define __NR_clone3 435 44 #endif 45 46 #ifndef __NR_pidfd_getfd 47 + #define __NR_pidfd_getfd 438 48 #endif 49 50 #ifndef PIDFD_NONBLOCK