freebsd-dev/cmd
наб 3bd6b0e05a
zed: protect against wait4()/fork() races to the global PID table
This can be very easily triggered by adding a sleep(1) before
the wait4() on a PID-starved system: the reaper thread would wait
for a child before its entry appeared, letting old entries accumulate:

  Invoking "all-debug.sh" eid=3021 pid=391
  Finished "(null)" eid=0 pid=391 time=0.002432s exit=0
  Invoking "all-syslog.sh" eid=3021 pid=336
  Finished "(null)" eid=0 pid=336 time=0.002432s exit=0
  Invoking "history_event-zfs-list-cacher.sh" eid=3021 pid=347
  Invoking "all-debug.sh" eid=3022 pid=349
  Finished "history_event-zfs-list-cacher.sh" eid=3021 pid=347
                                              time=0.001669s exit=0
  Finished "(null)" eid=0 pid=349 time=0.002404s exit=0
  Invoking "all-syslog.sh" eid=3022 pid=370
  Finished "(null)" eid=0 pid=370 time=0.002427s exit=0
  Invoking "history_event-zfs-list-cacher.sh" eid=3022 pid=391
  avl_find(tree, new_node, &where) == NULL
  ASSERT at ../../module/avl/avl.c:641:avl_add()
  Thread 1 "zed" received signal SIGABRT, Aborted.

By employing this wider lock, we atomise [wait, remove] and [fork, add]:
slowing down the reaper thread now just causes some zombies
to accumulate until it can get to them

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Don Brady <don.brady@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11963
Closes #11965
2021-05-07 15:10:16 -07:00
..
arc_summary arc_summary3: just read /s/m/{mod}/version instead of spawning cat 2021-04-11 11:57:14 -07:00
arcstat FreeBSD: Update usage of py-sysctl 2020-12-10 15:28:31 -08:00
dbufstat dbufstat: Fix warnings with Python 3.8 2020-12-23 15:10:35 -08:00
fsck_zfs fsck.zfs: implement 4/8 exit codes as suggested in manpage 2021-03-31 10:49:56 -07:00
mount_zfs cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
raidz_test Removed duplicated includes 2021-03-22 12:34:58 -07:00
vdev_id vdev_id: variable not getting expanded under map_slot() 2021-04-29 13:58:49 -07:00
zdb zdb: dump_history can be improved 2021-04-29 16:44:07 -07:00
zed zed: protect against wait4()/fork() races to the global PID table 2021-05-07 15:10:16 -07:00
zfs undocumented libzfs API changes broke "zfs list" 2021-05-06 11:24:56 -07:00
zfs_ids_to_path zfs_ids_to_path: print correct wrong values 2021-04-11 11:58:16 -07:00
zgenhostid Fix various typos 2021-04-02 18:52:15 -07:00
zhack cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zinject cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zpool Fix vdev health padding in zpool list -v 2021-04-14 09:02:16 -07:00
zpool_influxdb cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zstream Suppress cppcheck invalidSyntax warninigs 2021-03-05 17:56:35 -08:00
zstreamdump zstreamdump: exec zstream dump 2021-04-11 11:55:58 -07:00
ztest Fix various typos 2021-04-02 18:52:15 -07:00
zvol_id cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zvol_wait zvol_wait: properly handle zvol_volmode sysctl being 3/none 2021-04-11 11:58:36 -07:00
Makefile.am cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00