On Wed, Sep 22, 2021 at 03:00:37PM +0000, Mikolaj Kucharski wrote:
> Another one, it happened with below diff applied. Didn't had time yet to
> dive into this.

I have limited time in recent months, so I'm trying to put anything what
I have in spare moment. This should be more clear, from my previous
email.

Entries in dmesg, just before and from the panic()

ddb{0}> dmesg
OpenBSD 7.0 (GENERIC.MP) #4: Mon Sep 20 08:41:30 UTC 2021
    
r...@pc1.home.local:/home/mkucharski/openbsd/src/sys/arch/amd64/compile/GENERIC.MP
...
root on sd0a (f4c61a8acb9563fd.a) swap on sd0b dump on sd0b
MMM: ar5008_tx() [ar5008.c|1521]
MMM: ar5008_tx() [ar5008.c|1524]: key unset for sw crypto: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|278]: k_id: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|279]: k_flags: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|280]: k_len: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|281]: k_cipher: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|282]: k_key: 
0x0000000000000000000000000000000000000000000000000000000000000000
panic: ieee80211_encrypt: key unset for sw crypto: id=0 cipher=0 flags=0x0
Stopped at      db_enter+0x10:  popq    %rbp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
db_enter() at db_enter+0x10
panic(ffffffff81ea79d7) at panic+0xbf
ieee80211_encrypt(ffff80000009c048,fffffd80c307ce00,ffff800000d3e1c0) at 
ieee80211_encrypt+0x473
ar5008_tx(ffff80000009c000,fffffd80c307ce00,ffff800000d3e000,0) at 
ar5008_tx+0x1e7
athn_start(ffff80000009c048) at athn_start+0x108
ar5008_intr(ffff80000009c000) at ar5008_intr+0x216
intr_handler(ffff8000225a6d80,ffff80000008f780) at intr_handler+0x6e
Xintr_ioapic_level3_untramp() at Xintr_ioapic_level3_untramp+0x193
acpicpu_idle() at acpicpu_idle+0x11f
sched_idle(ffffffff821a7ff0) at sched_idle+0x27e
end trace frame: 0x0, count: 5


Below are dmesg entries and code responsible for those entries.

MMM: ar5008_tx() [ar5008.c|1521]
MMM: ar5008_tx() [ar5008.c|1524]: key unset for sw crypto: 0

  1514          if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
  1515                  k = ieee80211_get_txkey(ic, wh, ni);
  1516                  if (k->k_cipher == IEEE80211_CIPHER_CCMP) {
  1517                          u_int hdrlen = ieee80211_get_hdrlen(wh);
  1518                          if (ar5008_ccmp_encap(m, hdrlen, k) != 0)
  1519                                  return (ENOBUFS);
  1520                  } else {
  1521                          printf("MMM: %s() [%s|%d]\n", __func__, 
__FILE_NAME__, __LINE__);
  1522                          if ((k->k_flags & IEEE80211_KEY_SWCRYPTO) == 0)
  1523                                  printf("MMM: %s() [%s|%d]: key unset 
for sw crypto: %d\n",
  1524                                          __func__, __FILE_NAME__, 
__LINE__, k->k_id);
  1525                          if ((m = ieee80211_encrypt(ic, m, k)) == NULL)
  1526                                  return (ENOBUFS);
  1527                          k = NULL; /* skip hardware crypto further below 
*/
  1528                  }
  1529                  wh = mtod(m, struct ieee80211_frame *);
  1530          }

MMM: ieee80211_encrypt() [ieee80211_crypto.c|278]: k_id: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|279]: k_flags: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|280]: k_len: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|281]: k_cipher: 0
MMM: ieee80211_encrypt() [ieee80211_crypto.c|282]: k_key: 
0x0000000000000000000000000000000000000000000000000000000000000000

   273  struct mbuf *
   274  ieee80211_encrypt(struct ieee80211com *ic, struct mbuf *m0,
   275      struct ieee80211_key *k)
   276  {
   277          if ((k->k_flags & IEEE80211_KEY_SWCRYPTO) == 0) {
   278                  printf("MMM: %s() [%s|%d]: k_id: %d\n", __func__, 
__FILE_NAME__, __LINE__, k->k_id);
   279                  printf("MMM: %s() [%s|%d]: k_flags: %d\n", __func__, 
__FILE_NAME__, __LINE__, k->k_flags);
   280                  printf("MMM: %s() [%s|%d]: k_len: %d\n", __func__, 
__FILE_NAME__, __LINE__, k->k_len);
   281                  printf("MMM: %s() [%s|%d]: k_cipher: %d\n", __func__, 
__FILE_NAME__, __LINE__, k->k_cipher);
   282                  printf("MMM: %s() [%s|%d]: k_key: 0x", __func__, 
__FILE_NAME__, __LINE__);
   283                  for (int i = 0; i < sizeof(k->k_key); i++)
   284                          printf("%02x", k->k_key[i]);
   285                  printf("\n");
   286          }
   287  
   288          if ((k->k_flags & IEEE80211_KEY_SWCRYPTO) == 0)
   289                  panic("%s: key unset for sw crypto: id=%d cipher=%d 
flags=0x%x",
   290                      __func__, k->k_id, k->k_cipher, k->k_flags);
   291  

panic: ieee80211_encrypt: key unset for sw crypto: id=0 cipher=0 flags=0x0
Stopped at      db_enter+0x10:  popq    %rbp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
db_enter() at db_enter+0x10
panic(ffffffff81ea79d7) at panic+0xbf
ieee80211_encrypt(ffff80000009c048,fffffd80c307ce00,ffff800000d3e1c0) at 
ieee80211_encrypt+0x473
ar5008_tx(ffff80000009c000,fffffd80c307ce00,ffff800000d3e000,0) at 
ar5008_tx+0x1e7
athn_start(ffff80000009c048) at athn_start+0x108
ar5008_intr(ffff80000009c000) at ar5008_intr+0x216
intr_handler(ffff8000225a6d80,ffff80000008f780) at intr_handler+0x6e
Xintr_ioapic_level3_untramp() at Xintr_ioapic_level3_untramp+0x193
acpicpu_idle() at acpicpu_idle+0x11f
sched_idle(ffffffff821a7ff0) at sched_idle+0x27e

-- 
Regards,
 Mikolaj

Reply via email to