Merge tag 'sched_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fix from Borislav Petkov: "Fix task exposure order when forking tasks" * tag 'sched_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched: Fix yet more sched_fork() races
This commit is contained in:
@@ -2266,6 +2266,17 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
if (retval)
|
||||
goto bad_fork_put_pidfd;
|
||||
|
||||
/*
|
||||
* Now that the cgroups are pinned, re-clone the parent cgroup and put
|
||||
* the new task on the correct runqueue. All this *before* the task
|
||||
* becomes visible.
|
||||
*
|
||||
* This isn't part of ->can_fork() because while the re-cloning is
|
||||
* cgroup specific, it unconditionally needs to place the task on a
|
||||
* runqueue.
|
||||
*/
|
||||
sched_cgroup_fork(p, args);
|
||||
|
||||
/*
|
||||
* From this point on we must avoid any synchronous user-space
|
||||
* communication until we take the tasklist-lock. In particular, we do
|
||||
@@ -2375,7 +2386,7 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
fd_install(pidfd, pidfile);
|
||||
|
||||
proc_fork_connector(p);
|
||||
sched_post_fork(p, args);
|
||||
sched_post_fork(p);
|
||||
cgroup_post_fork(p, args);
|
||||
perf_event_fork(p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user