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)
Tue, Aug 4, 6:04 AM
Unknown Object (File)
Tue, Aug 4, 2:49 AM
Unknown Object (File)
Mon, Aug 3, 7:12 AM
Unknown Object (File)
Thu, Jul 30, 11:16 AM
Unknown Object (File)
Sun, Jul 26, 10:06 PM
Unknown Object (File)
Fri, Jul 24, 6:55 PM
Unknown Object (File)
Fri, Jul 24, 1:40 PM
Unknown Object (File)
Thu, Jul 23, 4:39 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 73008
Build 69891: arc lint + arc unit

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
3127

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?