From owner-freebsd-virtualization@FreeBSD.ORG Mon Jul 9 06:01:30 2012 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97AE1106566B for ; Mon, 9 Jul 2012 06:01:30 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9368FC0A for ; Mon, 9 Jul 2012 06:01:29 +0000 (UTC) Received: by wibhr14 with SMTP id hr14so2090026wib.13 for ; Sun, 08 Jul 2012 23:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ev9SlTeoY8sB/D1y71wWTV+Jfin/7hp1l2S0T9TD+MU=; b=m98eeDV4ElzLERaVZeK/EqaDS1/Xenj1w7Ux55WDKdDp/hD6gwlq2s9MCjSAxOfIz5 i/iZ1CxY4TtGoMu0kWsJ82rEymKXTclN3EMAgUnGmcLFAs8ZkGzMA2XMiWg4hb1NdrPn WvG6IlK07ZBYURWhuG0OJVuaJ+SMZ/D9R99Ii9mRHN+ixp+OFi8darfm810QXPMYhfXO RcWpz/vwwA9sA2dWG5Tn47eQU9jodwGEds5ZUoPJpZxT8XUTa4FlSsrNP+gXYY479n5D gz0K0w6q384A1KLYUvSINsxlsiS+hS+N7LHcTrHH/pT/hUpgLQQ4VK4rQLUFSuEj8crU 3DOw== Received: by 10.216.45.211 with SMTP id p61mr15258275web.188.1341813686946; Sun, 08 Jul 2012 23:01:26 -0700 (PDT) Received: from localhost ([188.230.122.226]) by mx.google.com with ESMTPS id ch9sm32379373wib.8.2012.07.08.23.01.24 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 Jul 2012 23:01:25 -0700 (PDT) From: Mikolaj Golub To: "Bjoern A. Zeeb" Organization: TOA Ukraine References: <4FF32FC4.6020701@delphij.net> <86wr2kau38.fsf@in138.ua3> <4FF5E87C.2020908@delphij.net> <86r4sqasrt.fsf@kopusha.home.net> <672D93D3-D4B1-432E-AE53-98E6C05B8BE4@lists.zabbadoz.net> <86zk7da10y.fsf@in138.ua3> <86obnqq94x.fsf@kopusha.home.net> <50CFED43-7789-4F27-9EC7-85268B7F23D4@lists.zabbadoz.net> Sender: Mikolaj Golub Date: Mon, 09 Jul 2012 09:01:23 +0300 In-Reply-To: <50CFED43-7789-4F27-9EC7-85268B7F23D4@lists.zabbadoz.net> (Bjoern A. Zeeb's message of "Sun, 8 Jul 2012 20:52:55 +0000") Message-ID: <86liit8ocs.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: d@delphij.net, FreeBSD virtualization mailing list Subject: Re: GPF when doing jail -r, possibly an use-after-free X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2012 06:01:30 -0000 On Sun, 8 Jul 2012 20:52:55 +0000 Bjoern A. Zeeb wrote: BAZ> Situation 1) BAZ> epairNa is in base, eiparNb is jail foo BAZ> stop jail foo: jail -r foo BAZ> both epairN[ab] will live in base and can be destiryed without vnet switching BAZ> Situation 2) BAZ> epairNa is in base, eiparNb is jail foo BAZ> you are in jail foo and type epairNb destroy; that should not be allowed BAZ> Situation 3) BAZ> epairNa is in base, eiparNb is jail foo BAZ> you are in base and type ifconfig epairNa destroy BAZ> This is your case ... I am not sure what I'd expect in this case, BAZ> especailly given epair is special... You probably are right. BAZ> Ideally I'd not allow it to be destroyed unless both are in the BAZ> if_home_vnet. However it seems we allow this; so in that case BAZ> I definitively make sure to use the CURVNET_SET_QUIET() version BAZ> to avoid the expected noise otherwise. It looks like epair was expected to allow this, because in non-patched version it already did switching before freeing the interface. It just did not switch bere detaching. CURVNET_SET_QUIET() is used in the current version of the patch so I suppose I can commit it. But if you think that just not allowing to destroy unless both ends are in the f_home_vnet is a preferred solution and it is not late to change this I can provide the patch. BAZ> The moment cloners will handle this it'll all be centrally managed BAZ> and individual device drivers shouldn't need to worry about it anymore. -- Mikolaj Golub