From owner-freebsd-jail@freebsd.org Fri Jan 4 20:12:24 2019 Return-Path: Delivered-To: freebsd-jail@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEC371438640 for ; Fri, 4 Jan 2019 20:12:24 +0000 (UTC) (envelope-from fabian.freyer@physik.tu-berlin.de) Received: from mail.physik.tu-berlin.de (mail.physik-pool.tu-berlin.de [130.149.50.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7BB8824A7 for ; Fri, 4 Jan 2019 20:12:23 +0000 (UTC) (envelope-from fabian.freyer@physik.tu-berlin.de) Received: from [192.168.0.114] (firewall02.physik-pool.tu-berlin.de [130.149.50.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.physik.tu-berlin.de (Postfix) with ESMTPSA id 09E0761F98; Fri, 4 Jan 2019 20:12:00 +0000 (UTC) Subject: Re: kqueue(2) kevents for jails To: Christian Barthel , Konstantin Belousov Cc: freebsd-jail@freebsd.org, stefan@gronke.net References: <106dc2ec-9b92-6885-ca4c-8422e0aa061c@physik.tu-berlin.de> <87k1jkmja7.fsf@x230.onfire.org> From: Fabian Freyer Message-ID: Date: Fri, 4 Jan 2019 21:11:58 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <87k1jkmja7.fsf@x230.onfire.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: C7BB8824A7 X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.55 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-0.22)[-0.222,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; HFILTER_HOSTNAME_4(2.50)[mail.physik-pool.tu-berlin.de]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[tu-berlin.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_SHORT(0.33)[0.327,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[25.50.149.130.list.dnswl.org : 127.0.11.2]; MX_GOOD(-0.01)[cached: a1861.mx.srv.dfn.de]; NEURAL_SPAM_LONG(0.27)[0.268,0]; IP_SCORE(-0.01)[asn: 680(-0.06), country: DE(-0.01)]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:680, ipnet:130.149.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2019 20:12:25 -0000 On 1/4/19 6:20 PM, Christian Barthel wrote: > I worked on something similar (not a library but more acting like a > daemon). The way I managed Jails was by forking a jail(8) process > and collecting the exit status. Not sure if that is possible for your > library case. Yes, I've thought about doing things like that too, like double-forking and having the parent wait for the jailed child, but those all seem dirty to me. Ideally, I'd like to register callbacks on jail state change to clean up file systems etc. On 1/4/19 5:14 PM, Konstantin Belousov wrote: > No, kevent(2) is not suitable mechanism to notify about jail state changes. > If anything in the existing system can be reused for such notifications, > it is devctl(4) notifications which are handled by devd(8). Look at the > man pages and for existing notifications in kernel code, e.g. > sys/kern/kern_conf.c notify*() for how devfs does it. Can any running binary subscribe to devd(8) events or does that require a configuration change in /etc/devd.conf?