syzbot


witness: userret: sendmsg

Status: fixed on 2022/07/02 17:14
Reported-by: syzbot+a648408d6a58fd40b59a@syzkaller.appspotmail.com
Fix commit: 635da3731041 Unlock peer in the SOCK_STREAM and SOCK_SEQPACKET error path.
First crash: 873d, last: 873d
Duplicate bugs (1)
duplicates (1):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
witness: thread exiting with locks held (2) 2 873d 873d 0/3 closed as dup on 2022/07/02 06:37

Sample crash report:
witness: userret: returning with the following locks held:
exclusive rwlock solock r = 0 (0xfffffd806e5bf818)
#0  witness_lock+0x44d
#1  unp_solock_peer+0x64 sys/kern/uipc_usrreq.c:168
#2  uipc_usrreq+0x7c6 sys/kern/uipc_usrreq.c:350
#3  sosend+0x61b sys/kern/uipc_socket.c:657
#4  sendit+0x65d sys/kern/uipc_syscalls.c:682
#5  sys_sendmsg+0x198 sys/kern/uipc_syscalls.c:589
#6  syscall+0x4c3 mi_syscall sys/sys/syscall_mi.h:101 [inline]
#6  syscall+0x4c3 sys/arch/amd64/amd64/trap.c:585
#7  Xsyscall+0x128
panic: witness_warn
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*489982  32988      0         0x2          0    0  syz-executor391347030
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437
panic(ffffffff82593e80) at panic+0x177 sys/kern/subr_prf.c:202
witness_warn(2,0,ffffffff82620d13) at witness_warn+0x65e witness_debugger sys/kern/subr_witness.c:2505 [inline]
witness_warn(2,0,ffffffff82620d13) at witness_warn+0x65e sys/kern/subr_witness.c:1473
userret(ffff8000ffff6010) at userret+0x265 sys/kern/kern_sig.c:2012
syscall(ffff8000212ca7d0) at syscall+0x57e mi_syscall_return sys/sys/syscall_mi.h:128 [inline]
syscall(ffff8000212ca7d0) at syscall+0x57e sys/arch/amd64/amd64/trap.c:607
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff35e0, count: 9
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
*cpu0: witness_warn
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437
panic(ffffffff82593e80) at panic+0x177 sys/kern/subr_prf.c:202
witness_warn(2,0,ffffffff82620d13) at witness_warn+0x65e witness_debugger sys/kern/subr_witness.c:2505 [inline]
witness_warn(2,0,ffffffff82620d13) at witness_warn+0x65e sys/kern/subr_witness.c:1473
userret(ffff8000ffff6010) at userret+0x265 sys/kern/kern_sig.c:2012
syscall(ffff8000212ca7d0) at syscall+0x57e mi_syscall_return sys/sys/syscall_mi.h:128 [inline]
syscall(ffff8000212ca7d0) at syscall+0x57e sys/arch/amd64/amd64/trap.c:607
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff35e0, count: -6
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff8000212ca500
rbx               0xffffffff82937bb7    cpu_info_full_primary+0x2bb7
rdx                            0x3fd
rcx                                0
rax                             0x14
r8                 0x101010101010101
r9                0x8080808080808080
r10               0x87f5ed08f7dee008
r11                0x2980cca2b01b5d4
r12               0xffffffff829379b8    cpu_info_full_primary+0x29b8
r13                                0
r14                                0
r15                              0x1
rip               0xffffffff81d03c18    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff8000212ca4f0
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (syz-executor391347030) pid=489982 stat=onproc
    flags process=2<EXEC> proc=0
    pri=51, usrpri=51, nice=20
    forw=0xffffffffffffffff, list=0xffff8000ffff62b0,0xffffffff82a6ea48
    process=0xffff8000ffff90a8 user=0xffff8000212c5000, vmspace=0xfffffd806eeb1738
    estcpu=1, cpticks=4, pctcpu=0.0
    user=0, sys=4, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*32988  489982  75733      0  7         0x2                syz-executor391347030
 75733  154019  27094      0  3    0x10008a  sigsusp       ksh
 27094  208170  55716      0  3        0x9a  kqread        sshd
 10504  280972      1      0  3    0x100083  ttyin         getty
 55716  464603      1      0  3        0x88  kqread        sshd
 29707  445066   4515     74  3   0x1100092  bpf           pflogd
  4515  242057      1      0  3        0x80  netio         pflogd
 49997   83821   8728     73  3   0x1100090  kqread        syslogd
  8728  509569      1      0  3    0x100082  netio         syslogd
 80959  483399      1      0  3    0x100080  kqread        resolvd
  2543  490016  54075     77  3    0x100092  kqread        dhcpleased
 41308  433394  54075     77  3    0x100092  kqread        dhcpleased
 54075   54192      1      0  3        0x80  kqread        dhcpleased
 19358  383060      0      0  3     0x14200  bored         smr
 32529  518329      0      0  3     0x14200  pgzero        zerothread
  7890  239989      0      0  3     0x14200  aiodoned      aiodoned
 51207  193625      0      0  3     0x14200  syncer        update
 19393  412249      0      0  3     0x14200  cleaner       cleaner
 48350  279266      0      0  3     0x14200  reaper        reaper
 98278  275782      0      0  3     0x14200  pgdaemon      pagedaemon
 31588  465780      0      0  3     0x14200  bored         viomb
 62219  437470      0      0  3  0x40014200  acpi0         acpi0
 86981   55714      0      0  7  0x40014200                idle1
 78419  286827      0      0  3     0x14200  bored         softnet
 97382  370260      0      0  3     0x14200  bored         softnet
 15307  232620      0      0  3     0x14200  bored         softnet
 75653  269235      0      0  3     0x14200  bored         softnet
 12085  468287      0      0  3     0x14200  bored         systqmp
 79659  199319      0      0  3     0x14200  bored         systq
 18302  168222      0      0  2  0x40014200                softclock
 54845  137682      0      0  3  0x40014200                idle0
     1    2919      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 32988 (syz-executor391347030) thread 0xffff8000ffff6010 (489982)
exclusive rwlock solock r = 0 (0xfffffd806e5bf818)
#0  witness_lock+0x44d
#1  unp_solock_peer+0x64 sys/kern/uipc_usrreq.c:168
#2  uipc_usrreq+0x7c6 sys/kern/uipc_usrreq.c:350
#3  sosend+0x61b sys/kern/uipc_socket.c:657
#4  sendit+0x65d sys/kern/uipc_syscalls.c:682
#5  sys_sendmsg+0x198 sys/kern/uipc_syscalls.c:589
#6  syscall+0x4c3 mi_syscall sys/sys/syscall_mi.h:101 [inline]
#6  syscall+0x4c3 sys/arch/amd64/amd64/trap.c:585
#7  Xsyscall+0x128
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf 10152   6455K    6456K  78643K     11242        0
            pcb    13      8K       8K  78643K        13        0
         rtable    58      1K       2K  78643K       108        0
         ifaddr    29      8K       8K  78643K        32        0
       counters    40     33K      33K  78643K        40        0
       ioctlops     0      0K       4K  78643K      1479        0
          mount     1      1K       1K  78643K         1        0
            log     0      0K       0K  78643K         5        0
         vnodes  1167     73K      73K  78643K      1180        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     2      0K       0K  78643K         2        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1697    195K     286K  78643K     12548        0
      file desc     1      0K       0K  78643K         1        0
           proc    67     91K      91K  78643K       282        0
    NFS srvsock     1      0K       0K  78643K         1        0
     NFS daemon     1     16K      16K  78643K         1        0
       in_multi    11      0K       0K  78643K        11        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    25    122K     122K  78643K        25        0
           exec     0      0K       2K  78643K       432        0
            tdb     3      0K       0K  78643K         3        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    57      3K       5K  78643K      1553        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     4      0K       0K  78643K         4        0
           temp    23   4705K    4769K  78643K      2510        0
         kqueue    11     16K      18K  78643K        24        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       22    0        0     1     0     1     1     0     8    0
rtpcb      120       17    0       14     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
unpcb      144       37    0       20     1     0     1     1     0     8    0
syncache   296        5    0        5     2     1     1     1     0     8    1
tcpcb      736        8    0        5     1     0     1     1     0     8    0
arp        120        2    0        0     1     0     1     1     0     8    0
inpcb      320       32    0       26     1     0     1     1     0     8    0
pfosfp      40     1428    0     1005     5     0     5     5     0     8    0
pfosfpen   112     1428    0      714    21     0    21    21     0     8    0
pfstitem    24        8    0        0     1     0     1     1     0     8    0
pfstkey    120        8    0        0     1     0     1     1     0     8    0
pfstate    336        8    0        0     1     0     1     1     0     8    0
pfrule     1360      21    0       16     2     1     1     2     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256       96    0        0     6     0     6     6     0     8    0
art_table   32       97    0        0     1     0     1     1     0     8    0
art_node    16       22    0        2     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256     1425    0       39    87     0    87    87     0     8    0
ffsino     272     1425    0       39    93     0    93    93     0     8    0
nchpl      144     1614    0       49    58     0    58    58     0     8    0
uvmvnodes   80     1435    0        0    30     0    30    30     0     8    0
vnodes     224     1435    0        0    85     0    85    85     0     8    0
namei      1024    4472    0     4472     2     1     1     1     0     8    1
percpumem   16       32    0        0     1     0     1     1     0     8    0
kstatmem   264        8    0        0     1     0     1     1     0     8    0
scxspl     216     3932    0     3932     3     2     1     2     0     8    1
plimitpl   152       16    0        9     1     0     1     1     0     8    0
sigapl     424      323    0      291     5     1     4     5     0     8    0
knotepl    120       50    0        0     2     0     2     2     0     8    0
kqueuepl   224       20    0       13     1     0     1     1     0     8    0
pipepl     336       86    0       83     2     1     1     1     0     8    0
fdescpl    496      306    0      291     3     0     3     3     0     8    0
filepl     152     1184    0     1124     3     0     3     3     0     8    0
lockfpl    104        6    0        4     1     0     1     1     0     8    0
lockfspl    48        4    0        2     1     0     1     1     0     8    0
sessionpl  144       18    0        9     1     0     1     1     0     8    0
pgrppl      48       18    0        9     1     0     1     1     0     8    0
ucredpl    104       69    0       57     1     0     1     1     0     8    0
zombiepl   144      291    0      291     2     1     1     1     0     8    1
processpl  1064     323    0      291     3     0     3     3     0     8    0
procpl     672      323    0      291     4     1     3     4     0     8    0
sockpl     504       86    0       60     5     1     4     4     0     8    0
mcl8k      8192       6    0        0     1     0     1     1     0     8    0
mcl4k      4096       3    0        0     1     0     1     1     0     8    0
mcl2k      2048      61    0        0     8     0     8     8     0     8    0
mtagpl      96        1    0        0     1     0     1     1     0     8    0
mbufpl     256      112    0        0     7     0     7     7     0     8    0
bufpl      288     2011    0       92   138     0   138   138     0     8    0
anonpl      24    39324    0    37340    16     2    14    15     0   186    1
amapchunkpl 152    2890    0     2794     6     1     5     6     0   158    0
amappl16   200       97    0       92     1     0     1     1     0     8    0
amappl13   176       34    0       33     2     1     1     1     0     8    0
amappl12   168        3    0        3     2     1     1     1     0     8    1
amappl11   160       66    0       49     1     0     1     1     0     8    0
amappl10   152        3    0        1     1     0     1     1     0     8    0
amappl9    144      485    0      483     1     0     1     1     0     8    0
amappl8    136      364    0      363     2     1     1     1     0     8    0
amappl7    128       53    0       50     1     0     1     1     0     8    0
amappl6    120      105    0       95     1     0     1     1     0     8    0
amappl5    112       92    0       79     1     0     1     1     0     8    0
amappl4    104      627    0      607     1     0     1     1     0     8    0
amappl3     96      363    0      340     1     0     1     1     0     8    0
amappl2     88      454    0      416     2     1     1     2     0     8    0
amappl1     80     9418    0     9017    12     2    10    11     0     8    0
amappl      88     1273    0     1233     2     0     2     2     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      72        2    0        0     1     0     1     1     0     8    0
uaddrrnd    24      306    0      291     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      306    0      291     1     0     1     1     0     8    0
vmmpekpl   168     6282    0     6269     1     0     1     1     0     8    0
vmmpepl    168    26986    0    26141    52    11    41    49     0   357    1
vmsppl     368      305    0      291     2     0     2     2     0     8    0
rwobjpl     56     9687    0     7687    30     0    30    30     0     8    1
pdppl      4096     619    0      582    57    20    37    49     0     8    0
pvpl        32   127905    0   123956    44     9    35    42     0   265    0
pmappl     248      305    0      291     2     0     2     2     0     8    0
extentpl    40       58    0       38     1     0     1     1     0     8    0
phpool     112      420    0       26    12     0    12    12     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:437
panic(ffffffff82593e80) at panic+0x177 sys/kern/subr_prf.c:202
witness_warn(2,0,ffffffff82620d13) at witness_warn+0x65e witness_debugger sys/kern/subr_witness.c:2505 [inline]
witness_warn(2,0,ffffffff82620d13) at witness_warn+0x65e sys/kern/subr_witness.c:1473
userret(ffff8000ffff6010) at userret+0x265 sys/kern/kern_sig.c:2012
syscall(ffff8000212ca7d0) at syscall+0x57e mi_syscall_return sys/sys/syscall_mi.h:128 [inline]
syscall(ffff8000212ca7d0) at syscall+0x57e sys/arch/amd64/amd64/trap.c:607
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff35e0, count: -6
ddb{0}> machine ddbcpu 1
Stopped at      x86_ipi_db+0x1a:        addq    $0x8,%rsp
x86_ipi_db(ffff800020dd8ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393
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+0x312 sys/dev/acpi/acpicpu.c:1206
sched_idle(ffff800020dd8ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: 10
ddb{1}> trace
x86_ipi_db(ffff800020dd8ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393
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+0x312 sys/dev/acpi/acpicpu.c:1206
sched_idle(ffff800020dd8ff0) at sched_idle+0x417 sys/kern/kern_sched.c:178
end trace frame: 0x0, count: -5
ddb{1}> 

Crashes (28):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/07/02 14:34 openbsd a4a82b864d54 1434eec0 .config console log report syz C ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 07:30 openbsd a4a82b864d54 1434eec0 .config console log report syz C ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 04:30 openbsd a4a82b864d54 1434eec0 .config console log report syz C ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 04:20 openbsd a4a82b864d54 1434eec0 .config console log report syz C ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 04:14 openbsd a4a82b864d54 1434eec0 .config console log report syz C ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 15:23 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 15:05 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 14:47 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 14:30 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 14:20 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 14:04 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 13:26 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 12:23 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 11:45 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 11:27 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 11:26 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 10:27 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 10:18 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 10:08 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 08:54 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 08:37 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 08:14 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 06:10 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
2022/07/02 05:08 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 04:27 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 04:06 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 04:04 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-setuid witness: userret: sendmsg
2022/07/02 04:00 openbsd a4a82b864d54 1434eec0 .config console log report ci-openbsd-multicore witness: userret: sendmsg
* Struck through repros no longer work on HEAD.