On Sun, 24 Nov 2024 16:55:55 +0100,
Martin Pieuchot <[email protected]> wrote:
>
> On 24/11/24(Sun) 16:51, Kirill A. Korinsky wrote:
> > On Sun, 24 Nov 2024 15:34:30 +0100,
> > Martin Pieuchot <[email protected]> wrote:
> > >
> > > On 23/11/24(Sat) 21:45, Kirill A. Korinsky wrote:
> > > > I had dig a bit future and setup a breakpoint at usbd_ref_decr.
> > > >
> > > > It was called from uvideo_vs_start_bulk_thread, but still it crahses:
> > >
> > > Could you check if uvideo_vs_close() is called multiple times?
> > >
> >
> > I had setup two breakpoints: uvideo_close and uvideo_vs_close because here
> > no uvideo_vs_close in stacktrace and probably it is inlined.
> >
> > uvideo_close was called twice: the first time after I kill ffplay, and the
> > second time when I deattach webcam.
>
> That might be the bug. Could you get us the trace for both threads?
>
>
After pkill -KILL ffplay
Breakpoint at uvideo_close: endbr64
ddb(2)> bt
uvideo_close(ffff800001a8e000) at uvideo_close
videoclose(2c01,3,2000,ffff80004bf20f90) at videoclose+0x63
spec_close(ffff80004bc692a8) at spec_close+0x107
VOP_CLOSE(fffff4b3df83e518,3,ffff80004b0e588,ffff80004bf20f90) at
VOP_CLOSE+0x59
vn_closefile(fffff4b3bbb4eae0,ffff80004bf20f90) at vn_closefile+0xaf
fdrop(fffff4b3bbb4eae0,ffff80004bf20f90) at fdrop+0xa5
closef(fffff4b3bbb4eae0,ffff80004bf20f90) at closef+0xaf
fdfree(ffff80004bf20f90) at fdfree+0xa6
exit1(ffff80004bf20f90,0,0,3) at exit1+0x29b
single_thread_check_locked(ffff80004bf20f90,0) at
single_thread_check_locked+0x197
userret(ffff80004bf20f90) at userret+0x1c5
syscall(ffff80004bc69520) at syscall+0x4f0
Xsyscall() at Xsyscall+0x120
end of kernel
end trace frame: 0x7c391574b790, count: -12
ddb(2)>
as a picture:
https://kirill.korins.ky/pub/openbsd-webcam-deattach-crash-break-at-pkill.jpg
And here after I deattach webcam:
Breakpoint at uvideo_close: endbr64
ddb(0)> bt
uvideo_close(ffff800001a8e000) at uvideo_close
videoclose(2c01,4,2000,ffff80003ab89968) at videoclose+0x63
spec_close(ffff80003ab8edf8) at spec_close+0x2b2
VOP_CLOSE(fffff483df83e518,4,ffffffffffffffff,ffff80003ab89968) at
VOP_CLOSE+0x59
vclean(fffff483df83e518,8,ffff80003ab89968) at vclean+0x147
vgonel(fffff483df83e518,ffff80003ab89968) at vgonel+0x67
vop_generic_revoke(ffff80003ab8ef28) at vop_generic_revoke+0x1a2
VOP_REVOKE(fffff483df83e518,1) at VOP_REVOKE+0x3b
vdevgone(2c,1,1,4) at vdevgone+0xd5
videodetach(ffff800001b3f000,1) at videodetach+0x57
config_detach(ffff800001b3f000,1) at config_detach+0x165
uvideo_detach(ffff800001a8e000,1) at uvideo_detach+0x4a
config_detach(ffff800001a8e000,1) at config_detach+0x166
usbd_detach(ffff800001bcb00,ffff800000303f80) at usbd_detach+0x5a
uhub_port_connect(ffff800000303f80,1,2a0) at uhub_port_connect+0x82
uhub_explore(ffff800000320300) at uhub_explore+0xb8
usb_explore(ffff800000320000) at usb_explore+0x13c
usb_task_thread(ffff80003ab89968) at usb_task_thread+0x110
end trace frame: 0x0, count: -17
ddb(0)> c
uvm_fault(0xfffffffd83dd957718, 0x3f, 0, 2) -> e
kernel: page fault trap, code=2
Stopped at usbd_close_pipe+0x91: movq %rcx,8x40(%rax)
TID PID UID PRFLAGS PRFLAGS CPU COMMAND
140383 76998 1000 0x100002 0 2 xconsole
117812 39140 0 0x14000 0x200 0 reaper
315707 49625 0 0x14000 0x200 1 softnet0
usbd_close_pipe(ffff800001b1b000) at usbd_close_pipe+0x91
uvideo_close(ffff800001a8e000) at uvideo_close+0x57
videoclose(2c01,3,2000,ffff80004bf20f90) at videoclose+0x63
spec_close(ffff80004bc692a8) at spec_close+0x107
VOP_CLOSE(fffff483df83e518,3,ffff483e090e688,ffff80004bf20f90) at
VOP_CLOSE+0x59
vn_closefile(fffff483bbb4eae0,ffff80004bf20f90) at vn_closefile+0xaf
fdrop(fffff483bbb4eae0,ffff80004bf20f90) at fdrop+0xa5
closef(fffff483bbb4eae0,ffff80004bf20f90) at closef+0xaf
fdfree(ffff80004bf20f90) at fdfree+0xa6
exit1(ffff80004bf20f90,0,0,3) at exit1+0x29b
single_thread_check_locked(ffff80004bf20f90,0) at
single_thread_check_locked+0x197
userret(ffff80004bf20f90) at userret+0x1c5
syscall(ffff80004bc69520) at syscall+0x4f0
Xsyscall() at Xsyscall+0x120
end of kernel
end trace frame: 0x7c391574b790, count: 1
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(3)>
again, here a picture:
https://kirill.korins.ky/pub/openbsd-webcam-deattach-crash-break-at-deattach.jpg
--
wbr, Kirill