From nobody Sun Apr 24 07:01:47 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 D6A02199EAD3 for ; Sun, 24 Apr 2022 07:02:01 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (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 4KmJwm6glYz3JWM for ; Sun, 24 Apr 2022 07:02:00 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: by mail-ed1-x530.google.com with SMTP id z19so1781218edx.9 for ; Sun, 24 Apr 2022 00:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W0K/uPbBqG/owECGzpYvZBmEoBvRlPKAM/GgBJskPYU=; b=V+W+biQ1EcgomhCCkdniT2JDaNjz/NR5DOBl5JBbjeEyu9y5eBwFTzPldKouS1w29B C90jhRZ1gVcvV2FoekAWxoFIGfOm+5rMRsEIdpqRvlNk0vsAqywWS5P6BS/wjJadLO8u TO1GeerYs1XacFfv3KITR0327D7l+T6HbN3PHOBZJ/y1fDzP2hmt1+LNjB0MiNkdo3iS qGcExChEzp/4mUTytGPFwqJfPAGk8pQCCoReN3Ze5fU9aq/gU0+WXYAqVw0TDhOcirZJ P6u//3YIV+BP2ti0cwHXbpn/J8308S+w9fZgXQETyhWfPIQM7Dvu0Qa4juXCFEpQeY2Y wwNA== 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=W0K/uPbBqG/owECGzpYvZBmEoBvRlPKAM/GgBJskPYU=; b=1rfxKOE24ommO8ZRS5InN9YqR9is0V0TkP6X1Rzf0jT/Ro5NEb2IMHhNhi+I1r9ooQ F0kuoFdN/WtqFqpWZZ9XydZFcWfoqg/niGrxhXdRVA238U2psnGbqp+DTseGb0drUTj0 5b0633Fvvsne1/cOmryr7Q2+bfjW0h6nAiKbxpCjCjZGlBJnkZQZV2te0/O6zh9NPbmk lkW4ypWLvl/RrBKhduk36nLsKyEpi7fADgu4+XMArRUU1eFuq9ZGt7qDXqqtJ2x4gwSI fgIdpON0GI0EWQjTW1pQ3EQ6gbf7nQ4RfTkgcj3cAbdNSzynfacDO8qVmH2bxdcdWgKm /yfQ== X-Gm-Message-State: AOAM530/x3FBwCHlW33XugCiqn2yKTErkSJPFCK88wh+9F3Vtd2CG9QZ nGOTk9bsnPanWZWQX5PyeLywAMfeQgYJDQJZHOiqXOCQ X-Google-Smtp-Source: ABdhPJzSzsGJNE9FER6qSrC3gkkF/aYVkDbJiB9tjC/m+1kPUODeF6uKPk8VG0C8iRQjLCPxrmNBBoMJ3f72Al0o6EY= X-Received: by 2002:a05:6402:3492:b0:423:dfe4:ec43 with SMTP id v18-20020a056402349200b00423dfe4ec43mr13304565edc.401.1650783719077; Sun, 24 Apr 2022 00:01:59 -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: <113d6d4d-eb23-30b1-a9e7-5a82a46604f8@grosbein.net> From: Rob Wing Date: Sat, 23 Apr 2022 23:01:47 -0800 Message-ID: Subject: Re: kernel crash making a vlan on a wlan To: Eugene Grosbein Cc: Marek Zarychta , freebsd-hackers@freebsd.org Content-Type: multipart/alternative; boundary="0000000000002d3a6f05dd610919" X-Rspamd-Queue-Id: 4KmJwm6glYz3JWM X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=V+W+biQ1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of robfx907@gmail.com designates 2a00:1450:4864:20::530 as permitted sender) smtp.mailfrom=robfx907@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::530:from]; MLMMJ_DEST(0.00)[freebsd-hackers]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --0000000000002d3a6f05dd610919 Content-Type: text/plain; charset="UTF-8" >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)); } #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. > > > > --0000000000002d3a6f05dd610919 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
From what I can tell, the vlan driver is calling ieee= 80211_output() with the wrong ifnet context and dereferencing a bad pointer= .

It looks like the passed in if_softc is poi= nting 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, struc= t 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 r= eturn ((*p->if_output)(p, m, dst, ro));
=C2=A0}

=C2=A0#ifdef A= LTQ


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 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.



--0000000000002d3a6f05dd610919--