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
Unknown Object (File)
Mon, Jul 21, 4:05 AM
Unknown Object (File)
Jun 23 2025, 11:03 PM
Unknown Object (File)
Jun 16 2025, 6:16 AM
Unknown Object (File)
Jun 13 2025, 3:16 PM
Unknown Object (File)
Jun 11 2025, 7:50 AM
Unknown Object (File)
Jun 10 2025, 12:50 PM
Unknown Object (File)
Jun 5 2025, 9:47 PM
Unknown Object (File)
May 17 2025, 1:01 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