diff options
| author | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-27 14:06:55 +0000 |
|---|---|---|
| committer | Kevin Bowling <kbowling@FreeBSD.org> | 2026-09-03 04:03:32 +0000 |
| commit | 74c539fd1cefdbc993411274c613434c3f23b4b1 (patch) | |
| tree | 6469cfaa78812c5e1e83f9f5def25d8d9ac0902b /source/Plugins/Process/mach-core/ThreadMachCore.cpp | |
| parent | f613a43c366600e8c388c3200f74c6dd27f8a7a2 (diff) | |
The TPM 2.0 character-device methods held the global device lock
while uiomove() accessed user memory. User page faults could therefore
delay suspend or detach even though the read response was already
buffered.
Add a per-open sleepable lock to serialize operations on each response
buffer. Stage commands under that lock before acquiring the device
lock, and copy them into the response buffer only after the lifecycle
checks succeed. This preserves an unread response when suspend or
detach rejects a write. Release the device lock before copying buffered
responses out. Also advance the response offset by the bytes actually
copied when uiomove() returns after a partial transfer.
Validated on an Intel TPM 2.0 TIS device. PCR reads and GetRandom
passed under 16-process mixed command load. A response was consumed
correctly in 5-byte, 7-byte, and remainder reads. Module unload/reload
recreated the device and entropy source without lock diagnostics.
Source inspection confirmed rejected writes preserve unread responses.
Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59245
Diffstat (limited to 'source/Plugins/Process/mach-core/ThreadMachCore.cpp')
0 files changed, 0 insertions, 0 deletions
