Page MenuHomeFreeBSD

mpr, mps: Fix a stack buffer overflow in the user passthru ioctl
ClosedPublic

Authored by markj on Jan 4 2021, 11:37 PM.
Tags
None
Referenced Files
F155062478: D27963.id81652.diff
Fri, May 1, 3:05 AM
F155042101: D27963.id81899.diff
Thu, Apr 30, 10:00 PM
F155033772: D27963.diff
Thu, Apr 30, 8:10 PM
Unknown Object (File)
Mon, Apr 20, 8:47 AM
Unknown Object (File)
Fri, Apr 17, 8:58 PM
Unknown Object (File)
Sat, Apr 4, 11:23 PM
Unknown Object (File)
Mar 23 2026, 7:42 AM
Unknown Object (File)
Mar 21 2026, 2:14 PM
Subscribers

Details

Summary

Previously we copied in the request into a stack-allocated structure
that could be smaller than the request size. Furthermore, we checked
the request size only after doing the copyin.

Fix this by allocating a buffer to hold the request, then copying the
buffer's contents into a command descriptor. This is a bit heavy-handed
but I expect the overhead will not be noticeable. The approach of
coping the header in first is susceptible to TOCTOU problems.

Test Plan

I don't have any hardware driven by mpr or mps. Would anyone be willing
to test?

Diff Detail

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