]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
jail: Don't allow jail_set(2) to resurrect dying jails.
authorJamie Gritton <jamie@FreeBSD.org>
Thu, 30 Nov 2023 00:12:13 +0000 (16:12 -0800)
committerJamie Gritton <jamie@FreeBSD.org>
Thu, 30 Nov 2023 00:12:13 +0000 (16:12 -0800)
commited31b3f4a146b3aa38f416954b6dbffad02efa5d
treeee900c68dac537badf7cc24348d432c23b97e0d2
parent376330aca1846d0f7771c16604b41bd7f6f1f14c
jail: Don't allow jail_set(2) to resurrect dying jails.

Currently, a prison in "dying" state (removed but still holding
resources) can be brought back to alive state via "jail -d", or
the JAIL_DYING flag to jail_set(2).  This seemed like a good idea
at the time.

Its main use was to improve support for specifying the jid when
creating a jail, which also seemed like a good idea at the time.
But resurrecting a jail that was partway through thr process of
shutting down is trouble waiting to happen.

This patch deprecates that flag, leaving it as a no-op for creating
jails (but still useful for looking at dying jails).  It sill allows
creating a new jail with the same jid as a dying one, but will renumber
the old one in that case.  That's imperfect, but allows for current
behavior.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D28150
lib/libc/sys/jail.2
sys/kern/kern_jail.c
sys/sys/jail.h
usr.sbin/jail/jail.8
usr.sbin/jail/jail.c