From owner-freebsd-jail@freebsd.org Wed May 6 18:55:14 2020 Return-Path: Delivered-To: freebsd-jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 710852DCD6D for ; Wed, 6 May 2020 18:55:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 49HQl62T4wz43Kx for ; Wed, 6 May 2020 18:55:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 52E652DCD6C; Wed, 6 May 2020 18:55:14 +0000 (UTC) Delivered-To: jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52A402DCD6B for ; Wed, 6 May 2020 18:55:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49HQl61QjMz43Kw; Wed, 6 May 2020 18:55:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 203B52A88C; Wed, 6 May 2020 18:55:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f176.google.com with SMTP id k12so2451419qtm.4; Wed, 06 May 2020 11:55:14 -0700 (PDT) X-Gm-Message-State: AGi0PuYNb96D1rZcAz3DUjWCUgH7WZTjL/yJ+W2fzdjhHfdRwy+yCCiQ W0f0mteSu4Hrt3L3c7nv9NqhZ77Gf3encBOFZZI= X-Google-Smtp-Source: APiQypJxkW5WiXwjCK9/AXW0QgwHi/yradPXeXSH92r43gaaU+ZYWXIGfZcFXrTntnHO+UoeefMVTc4UFw6iSeyq9Cc= X-Received: by 2002:ac8:2297:: with SMTP id f23mr3158599qta.60.1588791313718; Wed, 06 May 2020 11:55:13 -0700 (PDT) MIME-Version: 1.0 References: <20200506184923.GT39563@home.opsec.eu> In-Reply-To: <20200506184923.GT39563@home.opsec.eu> From: Kyle Evans Date: Wed, 6 May 2020 13:55:00 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Should killed process deref a jail? To: Kurt Jaeger Cc: jail@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2020 18:55:14 -0000 On Wed, May 6, 2020 at 1:49 PM Kurt Jaeger 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? > > Depends. If the last process held some socket and the socket > is still in the state LINGER. > > See > > https://deepix.github.io/2016/10/21/tcprst.html > > for more details, after the heading 'What is SO_LINGER?' > > You can probably see those sockets with > That'd make sense, but in this case it's actually reproducible with yes(1), which doesn't open up any sockets or actually use any external resources other than write()ing to stdout.