Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 May 2020 23:25:41 -0500
From:      Kyle Evans <kevans@freebsd.org>
Cc:        jail@freebsd.org
Subject:   Re: Should killed process deref a jail?
Message-ID:  <CACNAnaEQN4WPjGWrmVGgok6qyRRs=ULaAJ950_k=RyKjOUZf6w@mail.gmail.com>
In-Reply-To: <CACNAnaGssAKJ1-LhfQ1yszkOYkGw0iDsFgxmcuEZmTf9M-hyTg@mail.gmail.com>
References:  <CACNAnaGssAKJ1-LhfQ1yszkOYkGw0iDsFgxmcuEZmTf9M-hyTg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 6, 2020 at 1:42 PM Kyle Evans <kevans@freebsd.org> wrote:
>
> Hi,
>
> In doing some testing of qemu-user-static recently, I noticed that
> killing the last process in a non-persist jail doesn't kill off the
> jail:
>
> root@viper:/usr/src# jail -c path=/ command=yes
> ## ^C out
>
> root@viper:/usr/src# jls
>    JID  IP Address      Hostname                      Path
>    181                                                /
>
> root@viper:/usr/src# ps fxJ 181
> PID TT  STAT TIME COMMAND
>
> As a result, I ended up with 82 jails pointed at my armv7 sysroot and
> much surprise when I checked out `jls`. This vaguely smells like a
> bug, is this something that should be fixed?
>

I wrote a small utility to workaround this behavior:
https://git.kevans.dev/kevans/quickjail

I hope to quickly deprecate it with this review or something similar,
if it seems reasonable: https://reviews.freebsd.org/D24745 -> my
problem is entirely centered around sending ^C to the jail command=
that's hanging, which sends SIGINT to the entire foreground process
group, thus killing jail(8) in the process and preventing the cleanup
that should happen when the command terminates.

I think it's perhaps reasonable to just ignore SIGINT and let the
child deal with it or terminate to let jail(8) cleanup afterwards.
Perhaps the surface area in that review that's ignoring SIGINT (read:
the whole thing) is too large, but this is an exercise left up to
someone way more familiar with jail than I am.

Thanks,

Kyle Evans



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaEQN4WPjGWrmVGgok6qyRRs=ULaAJ950_k=RyKjOUZf6w>