From owner-freebsd-net@freebsd.org Wed Sep 5 10:39:28 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 A44CFFEB8C8 for ; Wed, 5 Sep 2018 10:39:28 +0000 (UTC) (envelope-from v.maffione@gmail.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 2CF897B570 for ; Wed, 5 Sep 2018 10:39:28 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id E5A32FEB8C7; Wed, 5 Sep 2018 10:39:27 +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 AB60AFEB8C6 for ; Wed, 5 Sep 2018 10:39:27 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BD017B56E; Wed, 5 Sep 2018 10:39:27 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mail-ed1-x52f.google.com with SMTP id f38-v6so5660235edd.8; Wed, 05 Sep 2018 03:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=n/mBTdH3Lh/SJR0wlKjnVXJ1b8H7ezrP+LTsbiGAXkE=; b=RJbDeqWiMHp9ywYzl8KWp89EM5zEBvE88Z3GMd4tA78PGMbrNIFZZok7ac0zvc/Kzo j7eA7t2slbSB9OXVM7d3WpzcFfwLILg/fkaetSWE71wImMqZRTFIAJgS5k2BdgghZWQp ZApApU2OH0Iw8PJH14FgyIzFth6bmsRXoDpljEHwol2zd3ap87hlhjqcE9H/U2JURoT8 GHu0Zvsl6vvxzlLJEwBQYWIEJ53xYLlyEIsTwFKl0VQrPluG62K9sym+W1ebx3mBx8XG qY2AeNssjVk45ikXeDtlQvXGH7gRW3ODvSgNi+O87d7UrK3N5mZVxbnhsaG5L3sLcoP6 UyeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=n/mBTdH3Lh/SJR0wlKjnVXJ1b8H7ezrP+LTsbiGAXkE=; b=Z7IYrpG3mxDU59MqxDS0Qpak+UwF0Hcu/iZrwWWcPYNzmRnICbHbeXtNCWSH9zHv+k ZZ0+PcvednHVpaiUZJlk6b+a8e9XFYzOmLLwVgWXOrQo7x9b0cn+l/2npM4geb/vVl2L ybxDcM03B28TD2AEbyCYEqt3Mrpc3S7QxU6THSOl8O+RPYviWGJvSkEJEyR4zOC+3rkz 7JmuzWs0Q9q84BOTvki3WZ4LnUN3VTPqkh7JHz7fGVb3PB3jPE+umuso+w48ebGTn6P1 7HyXyFQoo6qvcC8uUEOTh6Bc8M9AkWNwjdhKTpqLkvpLJmvy0WDkPG1n9jPr0og4Gi2F SH1A== X-Gm-Message-State: APzg51DeQGVhBaBmTd17JVUSfCtKRrTxQ2hr1Pq8EdGzaSwZyorYUgUI MChatBKWyEnBz/HD0gJQgu/1MFaimxnxQNoe+f0= X-Google-Smtp-Source: ANB0VdajnI3Y+YiyT87R9MyUD5RMBlfxzK9ginCYowfEx2aVzks7Qy8mmg9fn4uaJBLBbX4Oj2jRpFno5TMdq3sr4sE= X-Received: by 2002:a50:b2c6:: with SMTP id p64-v6mr40931131edd.293.1536143965329; Wed, 05 Sep 2018 03:39:25 -0700 (PDT) MIME-Version: 1.0 References: <20180901014953.GV45503@funkthat.com> <20180901211123.GZ45503@funkthat.com> <20180904164303.68c43b6e@x23> <20180904162815.GA75530@funkthat.com> <20180905104433.08ad13b8@x23> In-Reply-To: <20180905104433.08ad13b8@x23> From: Vincenzo Maffione Date: Wed, 5 Sep 2018 12:36:38 +0200 Message-ID: Subject: Re: vale and netmap module questions To: Marko Zec Cc: Luigi Rizzo , "freebsd-net@freebsd.org" , bz@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 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: Wed, 05 Sep 2018 10:39:29 -0000 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. Thanks, Vincenzo 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? > > Cheers, > > Marko > -- Vincenzo