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
F107511646: D27963.diff
Wed, Jan 15, 6:21 AM
F107497314: D27963.id81899.diff
Wed, Jan 15, 1:07 AM
Unknown Object (File)
Dec 10 2024, 7:46 PM
Unknown Object (File)
Nov 28 2024, 10:03 PM
Unknown Object (File)
Nov 11 2024, 5:59 AM
Unknown Object (File)
Nov 11 2024, 5:11 AM
Unknown Object (File)
Nov 10 2024, 11:57 PM
Unknown Object (File)
Nov 10 2024, 9:34 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35931
Build 32820: arc lint + arc unit