From owner-freebsd-net@freebsd.org Thu Sep 6 00:42:24 2018 Return-Path: Delivered-To: freebsd-net@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 891C6FCF917 for ; Thu, 6 Sep 2018 00:42:24 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 25F1D7C46F for ; Thu, 6 Sep 2018 00:42:24 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: by mailman.ysv.freebsd.org (Postfix) id DEA72FCF916; Thu, 6 Sep 2018 00:42:23 +0000 (UTC) Delivered-To: net@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 BCADCFCF915 for ; Thu, 6 Sep 2018 00:42:23 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gate2.funkthat.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 581BD7C46B; Thu, 6 Sep 2018 00:42:23 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id w860g8d3022568 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 5 Sep 2018 17:42:08 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.15.2/8.15.2/Submit) id w860g6KF022567; Wed, 5 Sep 2018 17:42:06 -0700 (PDT) (envelope-from jmg) Date: Wed, 5 Sep 2018 17:42:06 -0700 From: John-Mark Gurney To: Marko Zec Cc: Vincenzo Maffione , bz@freebsd.org, Luigi Rizzo , "freebsd-net@freebsd.org" Subject: Re: vale and netmap module questions Message-ID: <20180906004206.GB75530@funkthat.com> Mail-Followup-To: Marko Zec , Vincenzo Maffione , bz@freebsd.org, Luigi Rizzo , "freebsd-net@freebsd.org" References: <20180901014953.GV45503@funkthat.com> <20180901211123.GZ45503@funkthat.com> <20180904164303.68c43b6e@x23> <20180904162815.GA75530@funkthat.com> <20180905104433.08ad13b8@x23> <20180905124730.0f266c37@x23> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180905124730.0f266c37@x23> X-Operating-System: FreeBSD 11.0-RELEASE-p7 amd64 X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7 ED9B D5FF 5A51 C0AC 3D65 X-Files: The truth is out there X-URL: https://www.funkthat.com/ X-Resume: https://www.funkthat.com/~jmg/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (gold.funkthat.com [127.0.0.1]); Wed, 05 Sep 2018 17:42:08 -0700 (PDT) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 00:42:24 -0000 Marko Zec wrote this message on Wed, Sep 05, 2018 at 12:47 +0200: > On Wed, 5 Sep 2018 12:36:38 +0200 > Vincenzo Maffione wrote: > > > Hi Marko, > > Thanks a lot for identifying the problem. > > If I understand correctly, simply adding -D VIMAGE here > > https://github.com/luigirizzo/netmap/blob/master/sys/modules/netmap/Makefile#L11 > > would at least mitigate the issue. > > If you think I'm right I'll just add it. > > Right, go for it... Why not just hook up netmap to the build? Because if you add -DVIMAGE to the Makefile, you'll now break people who have kernels w/o VIMAGE.. And the only reason to build netmap module manually is because it's not hooked up. > > Il giorno mer 5 set 2018 alle ore 10:44 Marko Zec ha > > scritto: > > > > > On Tue, 4 Sep 2018 20:18:29 +0200 > > > Vincenzo Maffione wrote: > > > > > > > Hi, > > > > I don't think the panic depends on the architecture. Also, it > > > > does not depend on using emulated mode or not. > > > > We have seen this happening on x86_64 on FreeBSD 12 head. > > > > > > > > As John-Mark says, kdloading netmap.ko is not enough. You need to > > > > open a netmap port corresponding > > > > to any network interface, e.g. > > > > # pkt-gen -i eth0 > > > > because this will trigger ifunit_ref() in the kernel (netmap > > > > tries to grab the interface called "eth0"). > > > > The ifunit_ref() panics and we still need to figure out why. > > > > > > After more carefully rereading jmg's original report, on amd64 I > > > reproduced exactly the same panic he reported on arm64, the summary > > > follows: > > > > > > - the problem can be observed as VNET related, and can be triggered > > > only on kernels built with "options VIMAGE" but without "device > > > netmap". > > > > > > - netmap.ko built using make buildkernel works fine. > > > > > > - netmap.ko built separately (cd sys/modules/netmap; make) panics > > > on a first reference to vale interface, such as "tcpdump -ni > > > vale1:a" > > > > > > - the problem is that the separately built module is compiled > > > without "options VIMAGE", and as such does not set curvnet prior to > > > calling into network stack functions, therefore we have a null > > > pointer dereference in ifunit_ref() and voila... > > > > > > - hence, there's nothing to fix in the netmap code, and there's > > > nothing to fix in the network stack either related to this > > > particular problem, but rather we need a general mechanism which > > > would prevent kldloading non-VNETized .ko modules into a VNETized > > > kernel. I have no idea how to approach this, besides adding bz@ to > > > the cc: list, perhaps he could chime in with some thoughts? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."