Skip to content

Commit 4b06c99

Browse files
committed
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()
2 parents e0a0292 + 923936e commit 4b06c99

File tree

11 files changed

+45
-37
lines changed

11 files changed

+45
-37
lines changed

CREDITS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ S: Code 930.5, Goddard Space Flight Center
317317
S: Greenbelt, Maryland 20771
318318
S: USA
319319

320+
N: Joel Becker
321+
E: jlbec@evilplan.org
322+
D: configfs
323+
320324
N: Adam Belay
321325
E: ambx1@neo.rr.com
322326
D: Linux Plug and Play Support

MAINTAINERS

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5967,9 +5967,10 @@ S: Maintained
59675967
F: Documentation/security/snp-tdx-threat-model.rst
59685968

59695969
CONFIGFS
5970-
M: Joel Becker <jlbec@evilplan.org>
5970+
M: Andreas Hindborg <a.hindborg@kernel.org>
5971+
R: Breno Leitao <leitao@debian.org>
59715972
S: Supported
5972-
T: git git://git.infradead.org/users/hch/configfs.git
5973+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux.git configfs-next
59735974
F: fs/configfs/
59745975
F: include/linux/configfs.h
59755976
F: samples/configfs/
@@ -9106,7 +9107,7 @@ F: include/linux/iomap.h
91069107

91079108
FILESYSTEMS [NETFS LIBRARY]
91089109
M: David Howells <dhowells@redhat.com>
9109-
R: Jeff Layton <jlayton@kernel.org>
9110+
M: Paulo Alcantara <pc@manguebit.com>
91109111
L: netfs@lists.linux.dev
91119112
L: linux-fsdevel@vger.kernel.org
91129113
S: Supported

fs/cachefiles/namei.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
128128
ret = security_path_mkdir(&path, subdir, 0700);
129129
if (ret < 0)
130130
goto mkdir_error;
131-
subdir = ERR_PTR(cachefiles_inject_write_error());
132-
if (!IS_ERR(subdir))
131+
ret = cachefiles_inject_write_error();
132+
if (ret == 0)
133133
subdir = vfs_mkdir(&nop_mnt_idmap, d_inode(dir), subdir, 0700);
134-
ret = PTR_ERR(subdir);
134+
else
135+
subdir = ERR_PTR(ret);
135136
if (IS_ERR(subdir)) {
136137
trace_cachefiles_vfs_error(NULL, d_inode(dir), ret,
137138
cachefiles_trace_mkdir_error);

fs/exec.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,13 +1227,12 @@ int begin_new_exec(struct linux_binprm * bprm)
12271227
*/
12281228
bprm->point_of_no_return = true;
12291229

1230-
/*
1231-
* Make this the only thread in the thread group.
1232-
*/
1230+
/* Make this the only thread in the thread group */
12331231
retval = de_thread(me);
12341232
if (retval)
12351233
goto out;
1236-
1234+
/* see the comment in check_unsafe_exec() */
1235+
current->fs->in_exec = 0;
12371236
/*
12381237
* Cancel any io_uring activity across execve
12391238
*/
@@ -1495,6 +1494,8 @@ static void free_bprm(struct linux_binprm *bprm)
14951494
}
14961495
free_arg_pages(bprm);
14971496
if (bprm->cred) {
1497+
/* in case exec fails before de_thread() succeeds */
1498+
current->fs->in_exec = 0;
14981499
mutex_unlock(&current->signal->cred_guard_mutex);
14991500
abort_creds(bprm->cred);
15001501
}
@@ -1616,6 +1617,10 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
16161617
* suid exec because the differently privileged task
16171618
* will be able to manipulate the current directory, etc.
16181619
* It would be nice to force an unshare instead...
1620+
*
1621+
* Otherwise we set fs->in_exec = 1 to deny clone(CLONE_FS)
1622+
* from another sub-thread until de_thread() succeeds, this
1623+
* state is protected by cred_guard_mutex we hold.
16191624
*/
16201625
n_fs = 1;
16211626
spin_lock(&p->fs->lock);
@@ -1860,7 +1865,6 @@ static int bprm_execve(struct linux_binprm *bprm)
18601865

18611866
sched_mm_cid_after_execve(current);
18621867
/* execve succeeded */
1863-
current->fs->in_exec = 0;
18641868
current->in_execve = 0;
18651869
rseq_execve(current);
18661870
user_events_execve(current);
@@ -1879,7 +1883,6 @@ static int bprm_execve(struct linux_binprm *bprm)
18791883
force_fatal_sig(SIGSEGV);
18801884

18811885
sched_mm_cid_after_execve(current);
1882-
current->fs->in_exec = 0;
18831886
current->in_execve = 0;
18841887

18851888
return retval;

fs/exportfs/expfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,4 +608,5 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
608608
}
609609
EXPORT_SYMBOL_GPL(exportfs_decode_fh);
610610

611+
MODULE_DESCRIPTION("Code mapping from inodes to file handles");
611612
MODULE_LICENSE("GPL");

fs/namespace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5326,8 +5326,10 @@ struct kstatmount {
53265326
struct mnt_idmap *idmap;
53275327
u64 mask;
53285328
struct path root;
5329-
struct statmount sm;
53305329
struct seq_file seq;
5330+
5331+
/* Must be last --ends in a flexible-array member. */
5332+
struct statmount sm;
53315333
};
53325334

53335335
static u64 mnt_to_attr_flags(struct vfsmount *mnt)

include/linux/iomap.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ struct vm_fault;
7878
#define IOMAP_F_ANON_WRITE (1U << 7)
7979
#define IOMAP_F_ATOMIC_BIO (1U << 8)
8080

81+
/*
82+
* Flag reserved for file system specific usage
83+
*/
84+
#define IOMAP_F_PRIVATE (1U << 12)
85+
8186
/*
8287
* Flags set by the core iomap code during operations:
8388
*
@@ -88,14 +93,8 @@ struct vm_fault;
8893
* range it covers needs to be remapped by the high level before the operation
8994
* can proceed.
9095
*/
91-
#define IOMAP_F_SIZE_CHANGED (1U << 8)
92-
#define IOMAP_F_STALE (1U << 9)
93-
94-
/*
95-
* Flags from 0x1000 up are for file system specific usage:
96-
*/
97-
#define IOMAP_F_PRIVATE (1U << 12)
98-
96+
#define IOMAP_F_SIZE_CHANGED (1U << 14)
97+
#define IOMAP_F_STALE (1U << 15)
9998

10099
/*
101100
* Magic value for addr:

kernel/exit.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ void release_task(struct task_struct *p)
268268
leader = p->group_leader;
269269
if (leader != p && thread_group_empty(leader)
270270
&& 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;
271274
/*
272275
* If we were the last child thread and the leader has
273276
* exited already, and the leader's parent ignores SIGCHLD,
@@ -756,12 +759,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
756759
kill_orphaned_pgrp(tsk->group_leader, NULL);
757760

758761
tsk->exit_state = EXIT_ZOMBIE;
759-
/*
760-
* Ignore thread-group leaders that exited before all
761-
* subthreads did.
762-
*/
763-
if (!delay_group_leader(tsk))
764-
do_notify_pidfd(tsk);
765762

766763
if (unlikely(tsk->ptrace)) {
767764
int sig = thread_group_leader(tsk) &&
@@ -774,6 +771,8 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
774771
do_notify_parent(tsk, tsk->exit_signal);
775772
} else {
776773
autoreap = true;
774+
/* untraced sub-thread */
775+
do_notify_pidfd(tsk);
777776
}
778777

779778
if (autoreap) {

kernel/signal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,11 +2180,9 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
21802180

21812181
WARN_ON_ONCE(!tsk->ptrace &&
21822182
(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);
2183+
2184+
/* ptraced, or group-leader without sub-threads */
2185+
do_notify_pidfd(tsk);
21882186

21892187
if (sig != SIGCHLD) {
21902188
/*

tools/testing/selftests/clone3/clone3_selftests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr)))
1717

1818
#ifndef __NR_clone3
19-
#define __NR_clone3 -1
19+
#define __NR_clone3 435
2020
#endif
2121

2222
struct __clone_args {

0 commit comments

Comments
 (0)