Page MenuHomeFreeBSD

uvideo: import uvideo(4) driver from OpenBSD
ClosedPublic

Authored by bapt on May 12 2026, 11:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 15, 7:21 AM
Unknown Object (File)
Wed, Jul 15, 7:21 AM
Unknown Object (File)
Tue, Jul 14, 2:58 AM
Unknown Object (File)
Sun, Jul 5, 11:01 PM
Unknown Object (File)
Sun, Jul 5, 12:09 PM
Unknown Object (File)
Jun 10 2026, 11:00 PM
Unknown Object (File)
Jun 8 2026, 5:56 AM
Unknown Object (File)
Jun 4 2026, 3:28 AM

Details

Summary

Port the uvideo(4) driver from OpenBSD. This provides
native USB Video Class (UVC) support for webcams and video capture
devices.

The main changes are adaptation for:

  • USB transfer callback model
  • isoc data extraction via usbd_copy_out(),
  • V4L2 struct alignment for ABI compatibility with v4l_compat.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt requested review of this revision.May 12 2026, 11:37 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 16 2026, 11:23 AM
This revision was automatically updated to reflect the committed changes.
markj added inline comments.
sys/dev/usb/video/uvideo.c
3126

Why did you change this to contigmalloc()? It is a plain malloc() in OpenBSD.

@bapt this driver has some exploitable bugs, and it's accessible to unprivileged users (in the video group, but still). Many of them are the result of insufficient locking, e.g., multiple threads can race to call uvideo_streamoff() and trigger a double free. There is another problem with uvideo_mmap(): it maps a driver-allocated buffer which gets freed when the device file is closed, so the mapping can be used to access freed memory, same bug as the one fixed by 1b775b9ea4c1f4eb375c4309f8d6e90edb269844. (In fact I cannot see how OpenBSD handles this either.)

Do you have some time to help fix these problems?