Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Sep 2018 17:42:06 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Marko Zec <zec@fer.hr>
Cc:        Vincenzo Maffione <v.maffione@gmail.com>, bz@freebsd.org, Luigi Rizzo <rizzo@iet.unipi.it>, "freebsd-net@freebsd.org" <net@freebsd.org>
Subject:   Re: vale and netmap module questions
Message-ID:  <20180906004206.GB75530@funkthat.com>
In-Reply-To: <20180905124730.0f266c37@x23>
References:  <20180901014953.GV45503@funkthat.com> <CA%2B_eA9gH_uzxV_YLBH1XdM-ygPUxXzD_W9_b45jTmeY-t0bQKg@mail.gmail.com> <20180901211123.GZ45503@funkthat.com> <20180904164303.68c43b6e@x23> <20180904162815.GA75530@funkthat.com> <CA%2B_eA9jp2rB0GjojNrbWuQJ3fChpF6U5KPOX-DvEzJDVzOSP4w@mail.gmail.com> <20180905104433.08ad13b8@x23> <CA%2B_eA9gxCrJXVFaooD4x491Ksff5=gomwfn0=E0X0_iuupuBHg@mail.gmail.com> <20180905124730.0f266c37@x23>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <v.maffione@gmail.com> 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 <zec@fer.hr> ha
> > scritto:
> > 
> > > On Tue, 4 Sep 2018 20:18:29 +0200
> > > Vincenzo Maffione <v.maffione@gmail.com> 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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180906004206.GB75530>