From owner-freebsd-current@freebsd.org Tue May 14 16:10:40 2019 Return-Path: Delivered-To: freebsd-current@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 554D415920B6 for ; Tue, 14 May 2019 16:10:40 +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 BC10872CC6; Tue, 14 May 2019 16:10:39 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 5B2B05B98; Tue, 14 May 2019 16:10:39 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f179.google.com with SMTP id z1so14873902ljb.3; Tue, 14 May 2019 09:10:39 -0700 (PDT) X-Gm-Message-State: APjAAAXf2jv++/adDBUnHvgY3kAHABu9+bdh85YKFBC/x04ZEh0GPjT7 K8Me1MxLMyS7+zlOe7Dhg0ASNsHmmbaAfPlCI1o= X-Google-Smtp-Source: APXvYqyQb5jSS3EnJGLyvU/BVoF5GuabhTmclBhvTz4MM1Fl8Ry9YxVZINAGSYHgd/D8bkQLn2bRHV+q5J3AnmpwBS0= X-Received: by 2002:a2e:5b92:: with SMTP id m18mr18672611lje.115.1557850237925; Tue, 14 May 2019 09:10:37 -0700 (PDT) MIME-Version: 1.0 References: <20190514151002.GE51157@raichu> In-Reply-To: From: Kyle Evans Date: Tue, 14 May 2019 11:09:47 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: panic in tunstart_l2() To: Mark Johnston Cc: FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: BC10872CC6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2019 16:10:40 -0000 On Tue, May 14, 2019 at 10:34 AM Kyle Evans wrote: > > On Tue, May 14, 2019 at 10:10 AM Mark Johnston wrote: > > > > Hi, > > > > I hit the following panic last night on a non-INVARIANTS kernel at > > r347549. The workload involves running a number of bhyve VMs with > > frequent restarts, during which a tap interface is destroyed and > > recreated. I'm a bit short on time to debug this today, so while I > > retry with INVARIANTS on I thought I'd also report the issue in case > > anyone else is seeing it. > > > > The panic occurred because the ifnet's softc field is NULL. > > Ah, foo. I'll have to re-examine the ioctl/destroy race... tun_destroy > grabs the ioctl sx and kills off the if_softc, but it can not and > should not do this before if_detach or else things go wrong because > it's still a part of the bridge. I'm considering this patch [0] to move destroying the if_softc until after we've detached. We've already closed the tunnel, dropped all of our routes/addresses, and detach has freed us of our bridge responsibilities. It seems that we could still have a reference to the ifp in the ioctl path if something's entered just prior to detach, so we kill off the if_softc prior to freeing and the rest is safe. [0] https://people.freebsd.org/~kevans/tuntap-bridge.diff