Page MenuHomeFreeBSD

Don't allow jail "accidental" resurrection of dead jails.
ClosedPublic

Authored by jamie on Feb 6 2021, 9:21 PM.

Details

Summary

Stop dying jails from become alive again via races in fork(2) and jail_attach(2), and by the implicit rebirth of parent jails when a child jail is added when they're dying. Explicit rebirth the documented way, via the JAIL_DYING flag in jail_set(2), is still allowed.

The jail state and user reference count are a little more out of sync, with jail_remove(2) setting the state to dying before all the user references (processes) are gone. This makes pr_state the clear indicator of jail aliveness.

This builds on D28419, D27876, D28458, and D28473

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jamie requested review of this revision.Feb 6 2021, 9:21 PM
jamie created this revision.

Fix up prison_deref_kill, which had some typos in which prison it was acting on. Also move prisons off of their parent's child lists along with the loop instead of all at the end.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 23 2021, 1:05 AM
This revision was automatically updated to reflect the committed changes.