From nobody Sun Apr 24 13:35:08 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 C758F1A89B53 for ; Sun, 24 Apr 2022 13:35:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) (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 4KmTfd2ycGz3Dk6 for ; Sun, 24 Apr 2022 13:35:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe2b.google.com with SMTP id i186so11905499vsc.9 for ; Sun, 24 Apr 2022 06:35:21 -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=Fz9HpfTcLKvFxPxaMVFida+HaxfENIXAjVomwgzkyBI=; b=QqO6kj7q7CdwIqYAYdeZBiAFVk27B1mvQqcKrkzdnjvIySjy+hSf/e63Wr4GiA5WuR FVjKA0+pyH73dEkil9Ls8mRJAvoVeSBLc/RtrTaG1GeY5M4QH4PwOaFtN5c/X/KjUbOC 84Eg12py+VOA6KdITzGgRpfmYpxS314o5OKGSPl7pkirwjChqoVPwMKQZHkIzX8UiVIw jYohQz6DfbcDSxnNLOaWbGLQU+CiupD6Ta90ShjPLrzm8aa50VkQpv323If/XpslqBtG BbV4Sk0q+67NtBCfe7a3A5Z1DUB3fCuiGcW+7Ji7ZHmLft7Yeoacyyiw6vwi+pjFjT8M GnQw== 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=Fz9HpfTcLKvFxPxaMVFida+HaxfENIXAjVomwgzkyBI=; b=IOaEk3Q0A/SRImEtKcAittUDDsAnxtHYk/pNa7Va6kTHht6YufA170gXIVBzLCY3Y0 bZoRiVT0qVtNCY1fI39hsrEKUzXen+GkkEDnZ4bmF8oqAcBDho/8dAT2PHjGtA/OC6Pb EpkNlb8yn6a2RHw2lQs6Ui3XYFOkMIBL0XsS9lVUSe9/MaXF2ApTC8JG0z/DwIvDoSxO W5ESpxuCeN4QTEPbEMv2JlZGYlaaaej2eKFrYwe0/krGztHwjZlvZGpLo2iwMd8+KyDt 3UxYPCASt3Az+3rEGrVaERkDHHBF3XtgV4znhg8qqfOhEl3VYFsYIJEYUGHHD+ME7cDH xcHg== X-Gm-Message-State: AOAM531O136irBpUxqBKazrwQhvmTlXSu13ItMr6lP4CIdRP8plFhBVj dttEywciycym5MAT0TXkFXkjcagY3wXA8E3WTieH0Q== X-Google-Smtp-Source: ABdhPJyyUfJEF+7Z+60zFoA0JpEx1lbRSNKMO9dsXrcu4Febzd3H1EkF/VjqV7KbHBuXYfZZT3HnWODhsqIPye3Z8lQ= X-Received: by 2002:a67:f646:0:b0:32c:cc77:c201 with SMTP id u6-20020a67f646000000b0032ccc77c201mr168642vso.44.1650807320629; Sun, 24 Apr 2022 06:35:20 -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 07:35:08 -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="000000000000f0674e05dd66871b" X-Rspamd-Queue-Id: 4KmTfd2ycGz3Dk6 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=QqO6kj7q; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::e2b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.50 / 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(-1.00)[-0.999]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e2b: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:~]; RCVD_COUNT_TWO(0.00)[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)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000f0674e05dd66871b Content-Type: text/plain; charset="UTF-8" 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. >> >> >> >> --000000000000f0674e05dd66871b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


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 t= he passed in if_softc is pointing to a struct ifvlan instead of the expecte= d 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_out= put(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.

Warner=C2=A0

=C2=A0}

=C2=A0#ifdef ALTQ


On Sat, Apr 23,= 2022 at 1:12 PM Eugene Grosbein <eugen@grosbein.net> wrote:
<= /div>
24.04.2022 3:28, Mar= ek 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.



--000000000000f0674e05dd66871b--