]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
jail: Add PD_KILL to remove a prison in prison_deref().
authorJamie Gritton <jamie@FreeBSD.org>
Mon, 22 Feb 2021 20:27:44 +0000 (12:27 -0800)
committerJamie Gritton <jamie@FreeBSD.org>
Mon, 22 Feb 2021 20:27:44 +0000 (12:27 -0800)
commit811e27fa3c445664e36071a7d08228fc7fb85676
tree56a7436d99a78e496dfdc416c14d0d870474371e
parentab77cc9e7bf6d0c2d862dfd514539b81ae248dfd
jail: Add PD_KILL to remove a prison in prison_deref().

Add the PD_KILL flag that instructs prison_deref() to take steps
to actively kill a prison and its descendents, namely marking it
PRISON_STATE_DYING, clearing its PR_PERSIST flag, and killing any
attached processes.

This replaces a similar loop in sys_jail_remove(), bringing the
operation under the same single hold on allprison_lock that it already
has. It is also used to clean up failed jail (re-)creations in
kern_jail_set(), which didn't generally take all the proper steps.

Differential Revision:  https://reviews.freebsd.org/D28473
sys/kern/kern_jail.c
sys/sys/jail.h