On Sat, Apr 24, 2021 at 06:00:35PM -0600, Vitaliy Makkoveev wrote:
> CVSROOT:      /cvs
> Module name:  src
> Changes by:   m...@cvs.openbsd.org    2021/04/24 18:00:35
> 
> Modified files:
>       sys/kern       : uipc_socket.c uipc_socket2.c 
>       sys/net        : rtsock.c 
>       sys/sys        : socketvar.h 
> 
> Log message:
> Implement per-socket `so_lock' rwlock(9) and use it to protect routing
> (PF_ROUTE) sockets. This can be done because we have no cases where one
> thread should lock two sockets simultaneously.
> 
> Also this time `so_lock 'used for routing sockets only but in the future
> it will be used to other socket types too.
> 
> ok bluhm@

syzkaller found a new witness issue, is this commit the root cause?

HEAD commit:    b0cb8ce4 Asus USB-N10 should work with urtwn(4). Patch by ..
git tree:       openbsd
console output: https://syzkaller.appspot.com/x/log.txt?x=10612ccdd00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bf87b6915a88cd0d
dashboard link: https://syzkaller.appspot.com/bug?extid=eb593ee96235d71ade89

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+eb593ee96235d71ad...@syzkaller.appspotmail.com

login: panic: acquiring blockable sleep lock with spinlock or critical section 
held (rwlock) solock
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff823e90cf) at panic+0x15e sys/kern/subr_prf.c:218
witness_checkorder(fffffd806daa87a8,9,0) at witness_checkorder+0x1188 
sys/kern/subr_witness.c:833
rw_enter_write(fffffd806daa8798) at rw_enter_write+0x5b 
sys/kern/kern_rwlock.c:128
solock(fffffd806daa8790) at solock+0x97 sys/kern/uipc_socket2.c:299
rtm_senddesync_timer(fffffd806daa8790) at rtm_senddesync_timer+0x1a 
sys/net/rtsock.c:454
timeout_run(fffffd8074008810) at timeout_run+0xcc sys/kern/kern_timeout.c:674
softclock_process_tick_timeout(fffffd8074008810,0) at 
softclock_process_tick_timeout+0x196 sys/kern/kern_timeout.c:721
softclock(0) at softclock+0x11a sys/kern/kern_timeout.c:752
softintr_dispatch(0) at softintr_dispatch+0xfb 
sys/arch/amd64/amd64/softintr.c:90
Xsoftclock() at Xsoftclock+0x1f
acpicpu_idle() at acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
sched_idle(ffffffff8272eff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: 2
https://www.openbsd.org/ddb.html describes the minimum info required in bug
reports.  Insufficient info makes it difficult to find and fix bugs.
ddb{0}> 
ddb{0}> set $lines = 0
ddb{0}> set $maxwidth = 0
ddb{0}> show panic
acquiring blockable sleep lock with spinlock or critical section held (rwlock) 
solock
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff823e90cf) at panic+0x15e sys/kern/subr_prf.c:218
witness_checkorder(fffffd806daa87a8,9,0) at witness_checkorder+0x1188 
sys/kern/subr_witness.c:833
rw_enter_write(fffffd806daa8798) at rw_enter_write+0x5b 
sys/kern/kern_rwlock.c:128
solock(fffffd806daa8790) at solock+0x97 sys/kern/uipc_socket2.c:299
rtm_senddesync_timer(fffffd806daa8790) at rtm_senddesync_timer+0x1a 
sys/net/rtsock.c:454
timeout_run(fffffd8074008810) at timeout_run+0xcc sys/kern/kern_timeout.c:674
softclock_process_tick_timeout(fffffd8074008810,0) at 
softclock_process_tick_timeout+0x196 sys/kern/kern_timeout.c:721
softclock(0) at softclock+0x11a sys/kern/kern_timeout.c:752
softintr_dispatch(0) at softintr_dispatch+0xfb 
sys/arch/amd64/amd64/softintr.c:90
Xsoftclock() at Xsoftclock+0x1f
acpicpu_idle() at acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
sched_idle(ffffffff8272eff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: -13
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff80002116f480
rbx               0xffff80002116f490
rdx                             0x8b
rcx                              0x2
rax                              0x1
r8                0xffffffff814588c5    kprintf+0x145
r9                               0x1
r10               0x8419c6e0a8aafbb3
r11               0x89c57f072069aa71
r12                     0x3000000008
r13               0xffff80002116f530
r14                            0x100
r15                              0x1
rip               0xffffffff814ec468    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff80002116f470
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (idle0) pid=234235 stat=onproc
    flags process=14000<NOZOMBIE,SYSTEM> proc=40000200<SYSTEM,CPUPEG>
    pri=0, usrpri=50, nice=20
    forw=0x1034cbab1ede83b8, list=0xffff800021169a40,0xffff800021169510
    process=0xffff8000ffffee68 user=0xffff80002116a000, 
vmspace=0xffffffff827d9248
    estcpu=0, cpticks=8669, pctcpu=0.0
    user=0, sys=0, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 19747  171517  16883  32767  3        0x90  nanoslp       syz-executor.0
 19747   72118  16883  32767  3   0x4000090  kqread        syz-executor.0
 19747     930  16883  32767  3   0x4000090  fsleep        syz-executor.0
  4559  193882  82059  32767  3        0x90  piperd        syz-executor.1
 82059  382130   4948      0  3        0x82  wait          syz-executor.1
 16883  178379  16228  32767  3        0x90  nanoslp       syz-executor.0
 16228   83102   4948      0  3        0x82  wait          syz-executor.0
  4948  252150  17354      0  3        0x82  thrsleep      syz-fuzzer
  4948  337314  17354      0  3   0x4000082  nanoslp       syz-fuzzer
  4948  374769  17354      0  3   0x4000082  thrsleep      syz-fuzzer
  4948  193757  17354      0  3   0x4000082  thrsleep      syz-fuzzer
  4948   43742  17354      0  3   0x4000082  thrsleep      syz-fuzzer
  4948   52284  17354      0  3   0x4000082  thrsleep      syz-fuzzer
  4948  187559  17354      0  3   0x4000082  thrsleep      syz-fuzzer
  4948  109669  17354      0  3   0x4000082  kqread        syz-fuzzer
 17354   56894  85903      0  3    0x10008a  sigsusp       ksh
 85903  328915  55217      0  3        0x92  select        sshd
 65836  492423      1      0  3    0x100083  ttyin         getty
 55217  214370      1      0  3        0x80  select        sshd
 34988   10400  49756     73  3    0x100090  kqread        syslogd
 49756  302578      1      0  3    0x100082  netio         syslogd
 97371  443969      1     77  3    0x100090  poll          dhclient
 45596   82065      1      0  3        0x80  poll          dhclient
  2245  218126      0      0  3     0x14200  bored         smr
 63462  160351      0      0  3     0x14200  pgzero        zerothread
 30953   52838      0      0  3     0x14200  aiodoned      aiodoned
 95778  222888      0      0  3     0x14200  syncer        update
 95834  272931      0      0  3     0x14200  cleaner       cleaner
 83938   24065      0      0  3     0x14200  reaper        reaper
 37085  156735      0      0  3     0x14200  pgdaemon      pagedaemon
 55142  345126      0      0  3     0x14200  bored         crynlk
 22449  447604      0      0  3     0x14200  bored         crypto
 95652   95380      0      0  3     0x14200  bored         viomb
 95365  315544      0      0  3  0x40014200  acpi0         acpi0
 46855   55128      0      0  7  0x40014200                idle1
 41785   24642      0      0  3     0x14200  bored         softnet
 81736  153536      0      0  3     0x14200  bored         systqmp
 31125  111185      0      0  3     0x14200  bored         systq
 67871  448225      0      0  3  0x40014200  bored         softclock
*18999  234235      0      0  7  0x40014200                idle0
     1   97222      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
CPU 0:
shared mutex timeout r = 0 (0xffffffff826d40e8)
#0  witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4b0 sys/kern/subr_witness.c:1182
#1  timeout_run+0xb7 sys/kern/kern_timeout.c:670
#2  softclock_process_tick_timeout+0x196 sys/kern/kern_timeout.c:721
#3  softclock+0x11a sys/kern/kern_timeout.c:752
#4  softintr_dispatch+0xfb sys/arch/amd64/amd64/softintr.c:90
#5  Xsoftclock+0x1f
#6  acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
#7  sched_idle+0x417 sys/kern/kern_sched.c:178
#8  proc_trampoline+0x1c
Process 18999 (idle0) thread 0xffff8000211697a0 (234235)
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff828ab108)
#0  witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4b0 sys/kern/subr_witness.c:1182
#1  softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:90
#2  Xsoftclock+0x1f
#3  acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
#4  sched_idle+0x417 sys/kern/kern_sched.c:178
#5  proc_trampoline+0x1c
shared mutex timeout r = 0 (0xffffffff826d40e8)
#0  witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4b0 sys/kern/subr_witness.c:1182
#1  timeout_run+0xb7 sys/kern/kern_timeout.c:670
#2  softclock_process_tick_timeout+0x196 sys/kern/kern_timeout.c:721
#3  softclock+0x11a sys/kern/kern_timeout.c:752
#4  softintr_dispatch+0xfb sys/arch/amd64/amd64/softintr.c:90
#5  Xsoftclock+0x1f
#6  acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
#7  sched_idle+0x417 sys/kern/kern_sched.c:178
#8  proc_trampoline+0x1c
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf  9477   6349K    6349K  78643K     10567        0
            pcb    13      8K       8K  78643K        13        0
         rtable   105      3K       3K  78643K       333        0
         ifaddr    39     10K      10K  78643K        39        0
       counters    44     34K      34K  78643K        44        0
       ioctlops     0      0K       2K  78643K        19        0
            iov     0      0K      12K  78643K         2        0
          mount     1      1K       1K  78643K         1        0
            log     0      0K       0K  78643K         1        0
         vnodes  1216     76K      76K  78643K      1221        0
      UFS quota     1     32K      32K  78643K         1        0
      UFS mount     5     36K      36K  78643K         5        0
            shm     2      1K       1K  78643K         2        0
         VM map     2      1K       1K  78643K         2        0
            sem    12      1K       1K  78643K        16        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1697    195K     286K  78643K     12598        0
      file desc     7     21K      33K  78643K       320        0
          sigio     0      0K       0K  78643K         2        0
           proc    48     50K      70K  78643K       355        0
        subproc    34      2K       2K  78643K        34        0
    NFS srvsock     1      0K       0K  78643K         1        0
     NFS daemon     1     16K      16K  78643K         1        0
       in_multi    33      2K       2K  78643K        33        0
    ether_multi     1      0K       0K  78643K         1        0
    ISOFS mount     1     32K      32K  78643K         1        0
  MSDOSFS mount     1     16K      16K  78643K         1        0
           ttys    31    148K     148K  78643K        31        0
           exec     0      0K       2K  78643K       317        0
        pagedep     1      8K       8K  78643K         1        0
       inodedep     1     32K      32K  78643K         1        0
         newblk     1      0K       0K  78643K         1        0
        VM swap     7     26K      26K  78643K         7        0
       UVM amap   609     63K      63K  78643K      5480        0
       UVM aobj     3      2K       2K  78643K         3        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
            NDP     5      0K       0K  78643K         9        0
           temp    77   3971K    4035K  78643K      2377        0
         kqueue     3      4K       4K  78643K         3        0
      SYN cache     2     16K      16K  78643K         2        0
ddb{0}> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
plcache    128       20    0        0     1     0     1     1     0     8    0
rtpcb      120      129    0      125     1     0     1     1     0     8    0
rtentry    112       45    0        1     2     0     2     2     0     8    0
unpcb      120       67    0       59     1     0     1     1     0     8    0
syncache   296        4    0        4     1     1     0     1     0     8    0
tcpqe       32     4369    0     4369     1     1     0     1     0     8    0
tcpcb      736       14    0       10     1     0     1     1     0     8    0
arp         64        6    0        0     1     0     1     1     0     8    0
inpcb      304       35    0       29     1     0     1     1     0     8    0
nd6         48        6    0        0     1     0     1     1     0     8    0
kcovpl      48        2    0        0     1     0     1     1     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256      188    0        0    12     0    12    12     0     8    0
art_table   32      189    0        0     2     0     2     2     0     8    0
art_node    16       44    0        4     1     0     1     1     0     8    0
sysvmsgpl   40        8    0        8     1     1     0     1     0     8    0
semupl     112        3    0        3     1     1     0     1     0     8    0
semapl     112       10    0        0     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256     1703    0      306    88     0    88    88     0     8    0
ffsino     272     1703    0      306    94     0    94    94     0     8    0
nchpl      144     2223    0      623    60     0    60    60     0     8    0
uvmvnodes   72     1746    0        0    32     0    32    32     0     8    0
vnodes     224     1746    0        0   103     0   103   103     0     8    0
namei      1024    5240    0     5240     2     1     1     1     0     8    1
percpumem   16       33    0        0     1     0     1     1     0     8    0
scxspl     216     6562    0     6562    11    10     1     8     0     8    1
plimitpl   152       16    0        7     1     0     1     1     0     8    0
sigapl     424      507    0      475     4     0     4     4     0     8    0
futexpl     56     2431    0     2430     1     0     1     1     0     8    0
knotepl    112       62    0       42     1     0     1     1     0     8    0
kqueuepl   168      462    0      457     1     0     1     1     0     8    0
pipepl     336       73    0       62     3     1     2     2     0     8    1
fdescpl    496      491    0      475     3     0     3     3     0     8    0
filepl     152     2001    0     1900     6     1     5     5     0     8    1
lockfpl    104        5    0        4     1     0     1     1     0     8    0
lockfspl    48        3    0        2     1     0     1     1     0     8    0
sessionpl  144       17    0        7     1     0     1     1     0     8    0
pgrppl      48       17    0        7     1     0     1     1     0     8    0
ucredpl     96       69    0       60     1     0     1     1     0     8    0
zombiepl   144      475    0      475     2     1     1     1     0     8    1
processpl  1080     507    0      475     3     0     3     3     0     8    0
procpl     672      914    0      873     5     1     4     4     0     8    0
sockpl     480      235    0      217     4     0     4     4     0     8    1
mcl12k     12288      7    0        0     1     0     1     1     0     8    0
mcl8k      8192       7    0        0     1     0     1     1     0     8    0
mcl4k      4096       8    0        0     1     0     1     1     0     8    0
mcl2k2     2112       1    0        0     1     0     1     1     0     8    0
mcl2k      2048     296    0        0    36     0    36    36     0     8    0
mtagpl      96        1    0        0     1     0     1     1     0     8    0
mbufpl     256      462    0        0    26     1    25    25     0     8    0
bufpl      280     3563    0      145   245     0   245   245     0     8    0
anonpl      24   226812    0   127193   613     1   612   612     0   186    0
amapchunkpl 152   16041    0    12050   156     0   156   156     0   158    0
amappl16   200     2997    0      499   133     1   132   132     0     8    0
amappl15   192       52    0       47     1     0     1     1     0     8    0
amappl14   184      141    0      139     1     0     1     1     0     8    0
amappl13   176       25    0       23     1     0     1     1     0     8    0
amappl12   168       36    0       28     1     0     1     1     0     8    0
amappl11   160      217    0      205     1     0     1     1     0     8    0
amappl10   152       14    0        9     1     0     1     1     0     8    0
amappl9    144      289    0      287     1     0     1     1     0     8    0
amappl8    136      292    0      254     2     0     2     2     0     8    0
amappl7    128       54    0       42     1     0     1     1     0     8    0
amappl6    120       96    0       81     1     0     1     1     0     8    0
amappl5    112      273    0      263     1     0     1     1     0     8    0
amappl4    104      741    0      710     1     0     1     1     0     8    0
amappl3     96       78    0       72     1     0     1     1     0     8    0
amappl2     88      519    0      470     3     1     2     2     0     8    0
amappl1     80    11331    0    10916    12     2    10    12     0     8    0
amappl      88     5184    0     4630    13     0    13    13     0    92    0
dma4096    4096       1    0        1     1     1     0     1     0     8    0
dma1024    1024       1    0        0     1     0     1     1     0     8    0
dma256     256        6    0        6     1     1     0     1     0     8    0
dma128     128      253    0      253     1     1     0     1     0     8    0
dma64       64        6    0        6     1     1     0     1     0     8    0
dma32       32        7    0        7     1     1     0     1     0     8    0
dma16       16       18    0       17     1     0     1     1     0     8    0
aobjpl      64        2    0        0     1     0     1     1     0     8    0
uaddrrnd    24      491    0      475     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      491    0      475     1     0     1     1     0     8    0
vmmpekpl   168     7000    0     6977     2     0     2     2     0     8    0
vmmpepl    168    63124    0    58877   313    10   303   311     0   357  113
vmsppl     368      490    0      475     2     0     2     2     0     8    0
rwobjpl     56    14743    0    11165    52     1    51    52     0     8    0
pdppl      4096     989    0      950    64    23    41    45     0     8    2
pvpl        32   415973    0   312707   851     5   846   851     0   265    0
pmappl     232      490    0      475     2     1     1     2     0     8    0
extentpl    40       58    0       40     1     0     1     1     0     8    0
phpool     112      337    0       28     9     0     9     9     0     8    0
ddb{0}> machine ddbcpu 0
Invalid cpu 0
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff823e90cf) at panic+0x15e sys/kern/subr_prf.c:218
witness_checkorder(fffffd806daa87a8,9,0) at witness_checkorder+0x1188 
sys/kern/subr_witness.c:833
rw_enter_write(fffffd806daa8798) at rw_enter_write+0x5b 
sys/kern/kern_rwlock.c:128
solock(fffffd806daa8790) at solock+0x97 sys/kern/uipc_socket2.c:299
rtm_senddesync_timer(fffffd806daa8790) at rtm_senddesync_timer+0x1a 
sys/net/rtsock.c:454
timeout_run(fffffd8074008810) at timeout_run+0xcc sys/kern/kern_timeout.c:674
softclock_process_tick_timeout(fffffd8074008810,0) at 
softclock_process_tick_timeout+0x196 sys/kern/kern_timeout.c:721
softclock(0) at softclock+0x11a sys/kern/kern_timeout.c:752
softintr_dispatch(0) at softintr_dispatch+0xfb 
sys/arch/amd64/amd64/softintr.c:90
Xsoftclock() at Xsoftclock+0x1f
acpicpu_idle() at acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
sched_idle(ffffffff8272eff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: -13
ddb{0}> machine ddbcpu 1
Stopped at      x86_ipi_db+0x1a:        addq    $0x8,%rsp
x86_ipi_db(ffff800020d58ff0) at x86_ipi_db+0x1a 
sys/arch/amd64/amd64/db_interface.c:352
x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
acpicpu_idle() at acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
sched_idle(ffff800020d58ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: 10
ddb{1}> trace
x86_ipi_db(ffff800020d58ff0) at x86_ipi_db+0x1a 
sys/arch/amd64/amd64/db_interface.c:352
x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
acpicpu_idle() at acpicpu_idle+0x2eb sys/dev/acpi/acpicpu.c:1206
sched_idle(ffff800020d58ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: -5


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

-- 
You received this message because you are subscribed to the Google Groups 
"syzkaller-openbsd-bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to syzkaller-openbsd-bugs+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/syzkaller-openbsd-bugs/000000000000e4072305c0da6ed9%40google.com.

Reply via email to