On Tue, May 26, 2020 at 08:08:08AM +0000, Mikolaj Kucharski wrote:
> On Tue, May 26, 2020 at 09:56:02AM +0200, Stefan Sperling wrote:
> > On Tue, May 26, 2020 at 07:33:07AM +0000, Mikolaj Kucharski wrote:
> > > >Synopsis: panic: ieee80211_encrypt: key unset for sw crypto: 0
> > > >Category: kernel
> > > >Environment:
> > > System : OpenBSD 6.7
> > > Details : OpenBSD 6.7-current (GENERIC.MP) #217: Sun May 24
> > > 21:53:33 MDT 2020
> > >
> > > [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > >
> > > Architecture: OpenBSD.amd64
> > > Machine : amd64
> > >
> > > >Description:
> > > APU-based access point paniced after new wireless client booted up and
> > > started
> > > using wireless network for few minutes.
> > >
> > > ddb{0}> show panic
> > > ieee80211_encrypt: key unset for sw crypto: 0
> > >
> > > ddb{0}> trace
> > > db_enter() at db_enter+0x10
> > > panic(ffffffff81ca2fe1) at panic+0x128
> > > ieee80211_encrypt(ffff80000009b048,fffffd80cadc3000,ffff800000b981a0) at
> > > ieee80211_encrypt+0x5f
> > > ar5008_tx(ffff80000009b000,fffffd80cadc3000,ffff800000b98000,0) at
> > > ar5008_tx+0x172
> > > athn_start(ffff80000009b048) at athn_start+0x14c
> > > ar5008_intr(ffff80000009b000) at ar5008_intr+0x210
> > > intr_handler(ffff8000225b0350,ffff80000008c400) at intr_handler+0x6e
> > > Xintr_ioapic_level3_untramp() at Xintr_ioapic_level3_untramp+0x1a3
> > > acpicpu_idle() at acpicpu_idle+0x14d
> > > sched_idle(ffffffff81f20ff0) at sched_idle+0x225
> > > end trace frame: 0x0, count: -10
> >
> > Were you running anything that would cause an 'ifconfig athn0 down/up' at
> > the time, such as /etc/netstart or something like that?
>
> No, I was not logged in to access point and I don't have any scripts
> which touch network on that box. After machine boots up network on that
> box stays as is. At the time of the panic I think that OpenBSD machine
> was up about a day (it was rebooted the day before via sysupgrade(8)
> for an upgrade to snapshot version from the subject of this email).
>
> > Could you enable 'ifconfig athn0 debug' and if the problem occurs again,
> > check which, if any, interface state changes were reported in dmesg around
> > the time the problem occurred?
>
> I actually have debug enabled on this interface for couple of months
> now. This is what I see in /var/log/messages. MAC-address
> 80:1f:02:4b:6a:6b is that urtwn(4) from Pinebook, so it was when
> Pinebook booted up.
>
> I don't have exact timestamp when kernel paniced, but it's somewhere
> after 2020-05-26T06:46:09.060Z.
Thanks.
I don't yet have a definite idea what could cause this.
I did however notice a problem which may be related. Could you try this diff?
diff 3247d7f3b53b75bbaf4356f06f34208638ba213d /usr/src
blob - b44405af41448849059a4558c55bd182f823c1df
file + sys/net80211/ieee80211_proto.c
--- sys/net80211/ieee80211_proto.c
+++ sys/net80211/ieee80211_proto.c
@@ -433,6 +433,7 @@ ieee80211_setkeys(struct ieee80211com *ic)
{
struct ieee80211_key *k;
u_int8_t kid;
+ int rekeysta;
/* Swap(GM, GN) */
kid = (ic->ic_def_txkey == 1) ? 2 : 1;
@@ -457,6 +458,9 @@ ieee80211_setkeys(struct ieee80211com *ic)
}
ieee80211_iterate_nodes(ic, ieee80211_node_gtk_rekey, ic);
+ ieee80211_iterate_nodes(ic, ieee80211_count_rekeysta, &rekeysta);
+ if (rekeysta == 0)
+ ieee80211_setkeysdone(ic);
}
/*
@@ -466,6 +470,12 @@ void
ieee80211_setkeysdone(struct ieee80211com *ic)
{
u_int8_t kid;
+
+ /*
+ * Discard frames buffered for power-saving which were encrypted with
+ * the old group key. Clients are no longer able to decrypt them.
+ */
+ mq_purge(&ic->ic_bss->ni_savedq);
/* install GTK */
kid = (ic->ic_def_txkey == 1) ? 2 : 1;