From owner-dev-commits-src-main@freebsd.org Thu Feb 25 06:03:05 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4C5D5557C7A; Thu, 25 Feb 2021 06:03:05 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DmMf11cZhz3k8b; Thu, 25 Feb 2021 06:03:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (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 2A6D221AD5; Thu, 25 Feb 2021 06:03:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f169.google.com with SMTP id l132so3460999qke.7; Wed, 24 Feb 2021 22:03:05 -0800 (PST) X-Gm-Message-State: AOAM5327wWeSWNIJC5t4gEuXj70n/gqSB46IDV6AG77hw5u8XRqFn2+b e9q30JLLxE32El8O3ifbxX0sF56RK4/Dseyc5N0= X-Google-Smtp-Source: ABdhPJzZrGqSydT3HTRDZTq4/2RmDQGvpL17YdIvhVookpop9C/y6J6aWMWy1dXBTVU+ba+JE3DEM4+C+c287AZ1KiY= X-Received: by 2002:a37:a3c9:: with SMTP id m192mr1293846qke.103.1614232984780; Wed, 24 Feb 2021 22:03:04 -0800 (PST) MIME-Version: 1.0 References: <202102222027.11MKRtcl033616@gitrepo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Thu, 25 Feb 2021 00:02:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 811e27fa3c44 - main - jail: Add PD_KILL to remove a prison in prison_deref(). To: James Gritton Cc: Alexander Richardson , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2021 06:03:05 -0000 On Wed, Feb 24, 2021 at 11:53 PM James Gritton wrote: > > On 2021-02-24 21:29, Kyle Evans wrote: > > On Tue, Feb 23, 2021 at 7:16 AM Alexander Richardson > > wrote: > >> > >> On Mon, 22 Feb 2021 at 20:28, Jamie Gritton wrote: > >> > > >> > The branch main has been updated by jamie: > >> > > >> > URL: https://cgit.FreeBSD.org/src/commit/?id=811e27fa3c445664e36071a7d08228fc7fb85676 > >> > > >> > commit 811e27fa3c445664e36071a7d08228fc7fb85676 > >> > Author: Jamie Gritton > >> > AuthorDate: 2021-02-22 20:27:44 +0000 > >> > Commit: Jamie Gritton > >> > CommitDate: 2021-02-22 20:27:44 +0000 > >> > > >> > 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 > >> > >> Hi Jamie, > >> > >> After this commit running cd /usr/tests/lib/libc/sys && kyua test > >> cpuset_test renders the entire system unusable: all exec calls > >> afterwards seem to fail. In Jenkins it's triggering a kernel panic: > >> https://ci.freebsd.org/job/FreeBSD-main-amd64-test/17630/consoleFull > >> Reverting this commit fixes the issue. > >> > > > > Based on the backtrace and a wild stab in the dark, the last > > prison_deref() in do_jail_attach() prior to successful return should > > explicitly clear the PD_KILL flag from drflags. > > > > Thanks, > > > > Kyle Evans > > Yep, that's what's doing it. Actually, PD_KILL has no business being > passed to do_jail_attach in the first place. Running a test on that > right now. > Ah, good point! IMHO we should KASSERT() that as well in do_jail_attach(); it doesn't feel like we can do anything sensible with the flag there, so we might as well raise awareness that the caller needs to be more careful if attach failure is significant to the lifetime of the target.