Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Sep 2018 12:47:30 +0200
From:      Marko Zec <zec@fer.hr>
To:        Vincenzo Maffione <v.maffione@gmail.com>
Cc:        Luigi Rizzo <rizzo@iet.unipi.it>, "freebsd-net@freebsd.org" <net@freebsd.org>, <bz@freebsd.org>
Subject:   Re: vale and netmap module questions
Message-ID:  <20180905124730.0f266c37@x23>
In-Reply-To: <CA%2B_eA9gxCrJXVFaooD4x491Ksff5=gomwfn0=E0X0_iuupuBHg@mail.gmail.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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...

Marko


> 
> Thanks,
>   Vincenzo
> 
> 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?
> >
> > Cheers,
> >
> > Marko
> >  
> 
> 




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