summaryrefslogtreecommitdiffstats
path: root/include/zpios-internal.h
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-04-22 17:48:53 +0200
committerBrian Behlendorf <[email protected]>2021-04-22 14:53:51 -0700
commit8fd65351a7d1e40bbd2bd471b02e85937c9b2f80 (patch)
tree52de67e70b623ea6a532f51b2c760cc2f7387070 /include/zpios-internal.h
parent79d9f663b0dddcba7809fa7d28de11029005765d (diff)
zed: protect against wait4()/fork() races to the launched process tree
As soon as wait4() returns, fork() can immediately return with the same PID, and race to lock _launched_processes_lock, then try to add the new (duplicate) PID to _launched_processes, which asserts By locking before wait4(), we ensure, that, given that same unfortunate scheduling, _launched_processes_lock cannot be locked by the spawner before we pop the process in the reaper, and only afterward will it be added This moves where the reaper idles when there are children from the wait4() to the pause(), locking for the duration of that single syscall in both the no-children and running-children cases; the impact of this is one to two syscalls (depending on _launched_processes_lock state) per loop Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Don Brady <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11924 Closes #11928
Diffstat (limited to 'include/zpios-internal.h')
0 files changed, 0 insertions, 0 deletions