From nobody Sun Apr 24 14:37:46 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 188D81990BF1 for ; Sun, 24 Apr 2022 14:38:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KmW302mCNz3NMq for ; Sun, 24 Apr 2022 14:38:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe32.google.com with SMTP id j2so1255276vsp.5 for ; Sun, 24 Apr 2022 07:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qWrTtc0nZxtddzStvVqFgLveCdTy2cp2vH3vEFFvQPY=; b=u6hQBAxDmXibcAdYnEw/NHlkLYlOrlwP57z7BPXG50tKw1t1jJqTx79jjiCdiM+d8y u2GpuptDdTXwt68ydvA3tIMbD2yvM76NtJ5lANcBTWvJHJRVKCBOptPPy3TT3lqSurqb lh3IvspCRthXJK+lEUuzmhDhjDuhdtl5qT+gP1BODlcqjuF3cZo7ikI5UITklnnIafmH DsUO3w5FW0I20A3szPjYv1qX/Zx3NqkLwe4qgPyY3crrfh3z5P6ujtneXIfwYFoY3CpY 5v+k7kIi2B3KK5mqPBmA+2snKGsLE3ZLaw6AYy+v5eDRrVbPMn2g/dqc3so6fL0QBQyd fl5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qWrTtc0nZxtddzStvVqFgLveCdTy2cp2vH3vEFFvQPY=; b=xkrR6jr0EnrrqFegxxenJrC7+/wkcG/2/6uxHklwG1hGpuBnmqPJnANyrsewd3yv8j Y768WNqUFsfk+9JWb8fCJIlYJn29DQvdrHMMk3iTqzloQJk/0iCcg8M+98M/uBGnFpTb zgeJLjbttVr40fNyzC65tYKwyPDxDGAWGRR1ZtQgfG8gKRpYiq3OAakmEJRKputvyf/7 SdpoPAtj4BwK/6a0C8+tneaLMCMCVH/zm4+LJ2UkgEtjT3d0emim9r60amLZG3Q0zpk3 816i8oOAAOIrwPohqlEkn9upOtK9vefX4m3ySD3oUPjXBlX2EKOxFbHK6cBlvExYrQKW 46gA== X-Gm-Message-State: AOAM533+C0zsPRE8WrR+QL4oSQ+QoyRO7tHf8+NBcCxkEtg+dVeliIzj LAlHXf7ihSzt+UKdORBsg6vTIbJGqZ4xuwXQh4mCIaJ+/uo= X-Google-Smtp-Source: ABdhPJwJMiNl6kf4cIk0H4xxMExIWEUNvIO886Ge9bGs9jBPcQg2DJ55hhQ4ysOjlXl06e3l1ZNRZHnFFJ7FhpiyJe4= X-Received: by 2002:a67:f646:0:b0:32c:cc77:c201 with SMTP id u6-20020a67f646000000b0032ccc77c201mr208489vso.44.1650811078408; Sun, 24 Apr 2022 07:37:58 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: <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> In-Reply-To: From: Warner Losh Date: Sun, 24 Apr 2022 08:37:46 -0600 Message-ID: Subject: Re: kernel crash making a vlan on a wlan To: Rob Wing Cc: Eugene Grosbein , Marek Zarychta , FreeBSD Hackers Content-Type: multipart/alternative; boundary="000000000000eb8f2e05dd676790" X-Rspamd-Queue-Id: 4KmW302mCNz3NMq X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=u6hQBAxD; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::e32) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.41 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.91)[-0.907]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e32:from]; MLMMJ_DEST(0.00)[freebsd-hackers]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_SPF_NA(0.00)[no SPF record]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; SUSPICIOUS_RECIPS(1.50)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --000000000000eb8f2e05dd676790 Content-Type: text/plain; charset="UTF-8" On Sun, Apr 24, 2022, 8:36 AM Warner Losh wrote: > > > On Sun, Apr 24, 2022, 8:30 AM Rob Wing 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 wrote: >> >>> >>> >>> On Sun, Apr 24, 2022, 1:03 AM Rob Wing 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 >>>> 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


On Sun, Apr 24, 2022, 8:36 AM Warner Losh <imp@bsdimp.com> wrote:


On Sun, Apr 24, 2022, 8:30 AM Ro= b Wing <rob.fx907@gmail.com> wrote:
What do you mean when you say they are = the same thing?

<= /div>
There is no semantic difference between the two nota= tions. The change will have no effect.
=

Oh, I missed the ifp to p cha= nge. That will have a big effect.

Warner


Warner

<= /div>
On S= un, Apr 24, 2022 at 5:35 AM Warner Losh <imp@bsdimp.com> w= rote:


On Sun, Apr 24, 2022, 1:03 AM Rob Wing <rob.fx9= 07@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 ieee802= 11_vap

Looking at vlan_output(), I wonder if the p= arents ifnet context should be used when calling if_output()? something lik= e:

diff --git a/sys/net/if_vlan.c b/sys/net/if_vla= n.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,
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ifv =3D p->if_softc;
=C2=A0 =C2=A0= =C2=A0 =C2=A0 } while (p->if_type =3D=3D IFT_L2VLAN);

- =C2=A0 = =C2=A0 =C2=A0 return p->if_output(ifp, m, dst, ro);
+ =C2=A0 =C2=A0 = =C2=A0 return ((*p->if_output)(p, m, dst, ro));

No. Those two= are the same thing.

War= ner=C2=A0

=C2=A0}

=C2=A0#ifdef ALTQ


On Sat, Apr = 23, 2022 at 1:12 PM Eugene Grosbein <eugen@grosbei= n.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 se= ems wlan0 is part of the recipe, I tried vlans_em0=3D"vlan0" firs= t but was not able to induce a crash.
>>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Craig
>>
>
> I am curious what is this WiFi hardware that supports 802.1q tagging o= ver 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--