Date: Sun, 24 Apr 2022 08:37:46 -0600 From: Warner Losh <imp@bsdimp.com> To: Rob Wing <rob.fx907@gmail.com> Cc: Eugene Grosbein <eugen@grosbein.net>, Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: kernel crash making a vlan on a wlan Message-ID: <CANCZdfp4k5YYZ3RdPpW1n5ecPeyn%2BgymMh06iWLfkSVs-6W8BA@mail.gmail.com> In-Reply-To: <CANCZdfoXepZTpH_bvGkCyL1oSi84JwWYDpX3gsyBXEbbrt7bwQ@mail.gmail.com> References: <f08424d6-e209-928b-9927-3cc6c0aabb22@hesiod.org> <421d0c0d-4109-3370-9147-85168051deed@freebsd.org> <9ea3536e-b501-3684-850e-65f95fddf2e7@freebsd.org> <28c9ea32-b913-c153-005b-a62d6a7a6f4e@plan-b.pwste.edu.pl> <113d6d4d-eb23-30b1-a9e7-5a82a46604f8@grosbein.net> <CAF3%2Bn_dr1yeZnJkmyn3EBwSPfR%2BvQqT5h%2BtxtWp1=J5t0%2BD2Vg@mail.gmail.com> <CANCZdfq4W1r2Jd2kSLvdg00ACHqSZYQZJhYPAz77%2BsMBgcSBhw@mail.gmail.com> <CAF3%2Bn_c_3bF4aaBVsLOSJ8GhKmcQjujAC=gAvjjDhDHT%2BmzN8A@mail.gmail.com> <CANCZdfoXepZTpH_bvGkCyL1oSi84JwWYDpX3gsyBXEbbrt7bwQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000eb8f2e05dd676790 Content-Type: text/plain; charset="UTF-8" On Sun, Apr 24, 2022, 8:36 AM Warner Losh <imp@bsdimp.com> wrote: > > > On Sun, Apr 24, 2022, 8:30 AM Rob Wing <rob.fx907@gmail.com> wrote: > >> What do you mean when you say they are the same thing? >> > > There is no semantic difference between the two notations. The change will > have no effect. > Oh, I missed the ifp to p change. That will have a big effect. Warner > Warner > > On Sun, Apr 24, 2022 at 5:35 AM Warner Losh <imp@bsdimp.com> wrote: >> >>> >>> >>> On Sun, Apr 24, 2022, 1:03 AM Rob Wing <rob.fx907@gmail.com> wrote: >>> >>>> From what I can tell, the vlan driver is calling ieee80211_output() >>>> with the wrong ifnet context and dereferencing a bad pointer. >>>> >>>> It looks like the passed in if_softc is pointing to a struct ifvlan >>>> instead of the expected struct ieee80211_vap >>>> >>>> Looking at vlan_output(), I wonder if the parents ifnet context should >>>> be used when calling if_output()? something like: >>>> >>>> diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c >>>> index 2bb5284c2129..5fbd7a79dccc 100644 >>>> --- a/sys/net/if_vlan.c >>>> +++ b/sys/net/if_vlan.c >>>> @@ -1318,7 +1318,7 @@ vlan_output(struct ifnet *ifp, struct mbuf *m, >>>> const struct sockaddr *dst, >>>> ifv = p->if_softc; >>>> } while (p->if_type == IFT_L2VLAN); >>>> >>>> - return p->if_output(ifp, m, dst, ro); >>>> + return ((*p->if_output)(p, m, dst, ro)); >>>> >>> >>> No. Those two are the same thing. >>> >>> Warner >>> >>> } >>>> >>>> #ifdef ALTQ >>>> >>>> >>>> On Sat, Apr 23, 2022 at 1:12 PM Eugene Grosbein <eugen@grosbein.net> >>>> wrote: >>>> >>>>> 24.04.2022 3:28, Marek Zarychta wrote: >>>>> >>>>> > W dniu 23.04.2022 o 22:11, Craig Leres pisze: >>>>> >> >>>>> >> On 4/23/22 11:12, Craig Leres wrote: >>>>> >>> I am able to reproduce the crash with 13.1-RC4. >>>>> >> >>>>> >> I'm also able to reproduce the crash on 12.3-RELEASE-p5. It seems >>>>> wlan0 is part of the recipe, I tried vlans_em0="vlan0" first but was not >>>>> able to induce a crash. >>>>> >> >>>>> >> Craig >>>>> >> >>>>> > >>>>> > I am curious what is this WiFi hardware that supports 802.1q tagging >>>>> over the air? Could you please reveal this? >>>>> > >>>>> > That's rather not a bug when you are shooting yourself in the foot. >>>>> >>>>> Kernel panic due to ifconfig command is always a bug. >>>>> >>>>> >>>>> >>>>> --000000000000eb8f2e05dd676790 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">On Sun, Apr 24, 2022, 8:36 AM Warner Losh <<a href= =3D"mailto:imp@bsdimp.com">imp@bsdimp.com</a>> wrote:<br></div><blockquo= te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so= lid;padding-left:1ex"><div dir=3D"auto"><div><br><br><div class=3D"gmail_qu= ote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Apr 24, 2022, 8:30 AM Ro= b Wing <<a href=3D"mailto:rob.fx907@gmail.com" target=3D"_blank" rel=3D"= noreferrer">rob.fx907@gmail.com</a>> wrote:<br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex"><div dir=3D"ltr"><div>What do you mean when you say they are = the same thing?</div></div></blockquote></div></div><div dir=3D"auto"><br><= /div><div dir=3D"auto">There is no semantic difference between the two nota= tions. The change will have no effect.</div></div></blockquote></div></div>= <div dir=3D"auto"><br></div><div dir=3D"auto">Oh, I missed the ifp to p cha= nge. That will have a big effect.</div><div dir=3D"auto"><br></div><div dir= =3D"auto">Warner</div><div dir=3D"auto"><br></div><div dir=3D"auto"><div cl= ass=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0= .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"auto"><div d= ir=3D"auto"><br></div><div dir=3D"auto">Warner</div><div dir=3D"auto"><br><= /div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmai= l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left= :1ex"><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On S= un, Apr 24, 2022 at 5:35 AM Warner Losh <<a href=3D"mailto:imp@bsdimp.co= m" rel=3D"noreferrer noreferrer" target=3D"_blank">imp@bsdimp.com</a>> w= rote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p= x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir= =3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D= "gmail_attr">On Sun, Apr 24, 2022, 1:03 AM Rob Wing <<a href=3D"mailto:r= ob.fx907@gmail.com" rel=3D"noreferrer noreferrer" target=3D"_blank">rob.fx9= 07@gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" styl= e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin= g-left:1ex"><div dir=3D"ltr"><div>From what I can tell, the vlan driver is = calling ieee80211_output() with the wrong ifnet context and dereferencing a= bad pointer. <br></div><div><br></div><div>It looks like the passed in if_= softc is pointing to a struct ifvlan instead of the expected struct ieee802= 11_vap</div><div><br></div><div>Looking at vlan_output(), I wonder if the p= arents ifnet context should be used when calling if_output()? something lik= e:</div><div><br></div><div>diff --git a/sys/net/if_vlan.c b/sys/net/if_vla= n.c<br>index 2bb5284c2129..5fbd7a79dccc 100644<br>--- a/sys/net/if_vlan.c<b= r>+++ b/sys/net/if_vlan.c<br>@@ -1318,7 +1318,7 @@ vlan_output(struct ifnet= *ifp, struct mbuf *m, const struct sockaddr *dst,<br>=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ifv =3D p->if_softc;<br>=C2=A0 =C2=A0= =C2=A0 =C2=A0 } while (p->if_type =3D=3D IFT_L2VLAN);<br><br>- =C2=A0 = =C2=A0 =C2=A0 return p->if_output(ifp, m, dst, ro);<br>+ =C2=A0 =C2=A0 = =C2=A0 return ((*p->if_output)(p, m, dst, ro));<br></div></div></blockqu= ote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">No. Those two= are the same thing.</div><div dir=3D"auto"><br></div><div dir=3D"auto">War= ner=C2=A0</div><div dir=3D"auto"><br></div><div dir=3D"auto"><div class=3D"= gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px = 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"= ltr"><div>=C2=A0}<br><br>=C2=A0#ifdef ALTQ</div><div><br></div></div><br><d= iv class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Apr = 23, 2022 at 1:12 PM Eugene Grosbein <<a href=3D"mailto:eugen@grosbein.ne= t" rel=3D"noreferrer noreferrer noreferrer" target=3D"_blank">eugen@grosbei= n.net</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"ma= rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:= 1ex">24.04.2022 3:28, Marek Zarychta wrote:<br> <br> > W dniu 23.04.2022 o 22:11, Craig Leres pisze:<br> >><br> >> On 4/23/22 11:12, Craig Leres wrote:<br> >>> I am able to reproduce the crash with 13.1-RC4.<br> >><br> >> I'm also able to reproduce the crash on 12.3-RELEASE-p5. It se= ems wlan0 is part of the recipe, I tried vlans_em0=3D"vlan0" firs= t but was not able to induce a crash.<br> >><br> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Craig<br> >><br> > <br> > I am curious what is this WiFi hardware that supports 802.1q tagging o= ver the air? Could you please reveal this?<br> > <br> > That's rather not a bug when you are shooting yourself in the foot= .<br> <br> Kernel panic due to ifconfig command is always a bug.<br> <br> <br> <br> </blockquote></div> </blockquote></div></div></div> </blockquote></div> </blockquote></div></div></div> </blockquote></div></div></div> --000000000000eb8f2e05dd676790--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfp4k5YYZ3RdPpW1n5ecPeyn%2BgymMh06iWLfkSVs-6W8BA>