From nobody Sun Apr 24 14:36:06 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 7667D1A972F2 for ; Sun, 24 Apr 2022 14:36:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe33.google.com (mail-vs1-xe33.google.com [IPv6:2607:f8b0:4864:20::e33]) (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 4KmW1538q5z3M9C for ; Sun, 24 Apr 2022 14:36:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe33.google.com with SMTP id u205so4507971vsu.6 for ; Sun, 24 Apr 2022 07:36:25 -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=a5IhorgUl5BgFBd358qEcl1FCCrjAXtNvR2635KZi6k=; b=W54P6IDlsMSeYO/0FjMxiubfW2PV4gzAjCWiBQbVLP8WmsvVrq+9OSX8aHMcu/EFSs D3OoVdnU3l9Hr+1sFmjnPMKeVH887ubnaKgrN9qSPtSVncwhL1ngp2NtfIlSZQSLRUM7 7kdzCq9IZlV/mijf69Vut0dnO9f17eJmbSHinSQcKsZfk4xj/bI3dmynZcfOBFiEpUQw P4pANnjtUTUxpuKtPbn/61uUZA0uJidXfbXaR7Qb99NE6bss86u3wAEpYcdkyDUo5yQR hh8FJvUPJpobRaC0qg81XXGzuTu6KC3HXHVsiQ+iQt5+1QO/2ggfmzke9V5slJh09Wft 4Rgg== 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=a5IhorgUl5BgFBd358qEcl1FCCrjAXtNvR2635KZi6k=; b=JOJB96jnS9+AcuszZfL2CE3uZVOSoNvmbdaiPl7Ss2Ga+3D5qokmj1vYt0EZnkt8ne 4Q2mAOktUFr+f4KueeAPnl//Iyk9JrsPYo6yR6UKUfu6Y1D/C01d+XlRzKNiBn0AeK1X 1x9SZ1WpQrKckifRPwPhXGFJJNekbk9Pqetac9VxXZd1+OV9G+Hn7QMkcOVVH9U8W/Uw j1JkbB3FSWdO9m2KTZ6xbjBMUmTGBMGDC/hXqmiIVu0W5PJfyvlJ86cqBPOLObeTlLHO qARg093aj+GXK4vZfa6fAVsJbXCLUiOU6kXQBHEO10qUwp49FNRUAY2qXg0zrjFpwNj9 35dQ== X-Gm-Message-State: AOAM5300Nr7l/mlzHG6ycf3WsyxcBeOrnIylk0CILNTjickkAPXBuazu RzvyLPRlW1ijfBh2nUu+jve5bvZ++af2l24Ho0hy+w== X-Google-Smtp-Source: ABdhPJzI+YyWOfC4kSVfrLxL1zuQDBSOX7Y4Lx4MPKjvEHLvHtnyFZft6oXth+FefwvLb8snqNgOtKQzDfCysnlmLzA= X-Received: by 2002:a67:f445:0:b0:32c:c32c:c7c1 with SMTP id r5-20020a67f445000000b0032cc32cc7c1mr583705vsn.51.1650810978888; Sun, 24 Apr 2022 07:36:18 -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:36:06 -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="000000000000fd015a05dd6761d0" X-Rspamd-Queue-Id: 4KmW1538q5z3M9C X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=W54P6IDl; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::e33) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.40 / 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.90)[-0.904]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e33: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 --000000000000fd015a05dd6761d0 Content-Type: text/plain; charset="UTF-8" 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. 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. >>>> >>>> >>>> >>>> --000000000000fd015a05dd6761d0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


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 betwe= en the two notations. The change will have no effect.

Warner

On Sun, Apr 24= , 2022 at 5:35 AM Warner Losh <imp@bsdimp.com> wrote:

On Sun, A= pr 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 t= he wrong ifnet context and dereferencing a bad pointer.

=
It looks like the passed in if_softc is pointing to a struct ifv= lan instead of the expected struct ieee80211_vap

L= ooking at vlan_output(), I wonder if the parents ifnet context should be us= ed when calling if_output()? something like:

diff = --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 2bb5284c2129..5fbd7a= 79dccc 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 stru= ct 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->i= f_type =3D=3D IFT_L2VLAN);

- =C2=A0 =C2=A0 =C2=A0 return p->if_ou= tput(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.

Warner=C2=A0
=
=C2=A0}

=C2=A0#i= fdef ALTQ


On Sat, Apr 23, 2022 at 1:12 PM Eugene Grosbe= in <eugen@grosbein.net> wrote:
24.04.2022 3:28, Marek Zarychta wrote:<= br>
> 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.



--000000000000fd015a05dd6761d0--