Page MenuHomeFreeBSD

Fix circular reaper dependency after r275800.
ClosedPublic

Authored by bz on Jun 20 2018, 8:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 10 2024, 11:35 PM
Unknown Object (File)
Jan 7 2024, 8:06 AM
Unknown Object (File)
Dec 19 2023, 4:26 PM
Unknown Object (File)
Dec 11 2023, 10:03 PM
Unknown Object (File)
Nov 28 2023, 8:32 PM
Unknown Object (File)
Nov 26 2023, 2:17 AM
Unknown Object (File)
Nov 12 2023, 3:56 PM
Unknown Object (File)
Oct 19 2023, 11:55 PM
Subscribers

Details

Summary

With the introduction of reapers and reaplists in r275800,
proc0 and init are setup as a circular dependency.

create_init() calls fork1() which calls do_fork(). There the
newproc (initproc) is setup with a reaper of proc0 who's reaper
points to itself. The newproc (initproc) is then put on its
reaper's (proc0) p_reaplist (initproc is a descendants of proc0
for proc0 to reap). Upon return to create_init(), proc0 is
added to initproc's p_reaplist (which would mean proc0 is a
descendant of init, for init to reap). This creates a
circular dependency which eventually leads to LIST corruptions
when trying to kill init and a proc0.

For the base system we never really hit this case during reboot.
The problem only became visible after adding more virtual process
spaces which could cleanly go away in an experimental branch.

Sponsored by: iXsystems, Inc.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This is somewhat orthogonal, but since you are makes the init the proper child of the proc0, shouldn't proc0 get the P_TREE_REAPER flag ? Otherwise, dying init would confuse the reaping code. We do allow init(8) to die sometimes, without inducing the panic.

  • Set P_TREE_REAPER on proc0 given it is the reaper for init now.
This revision is now accepted and ready to land.Jul 5 2018, 3:51 PM
This revision was automatically updated to reflect the committed changes.