diff options
| author | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-27 12:42:28 +0000 |
|---|---|---|
| committer | Kevin Bowling <kbowling@FreeBSD.org> | 2026-09-03 03:56:23 +0000 |
| commit | a3daa1e8f5988045e8042fb3fe376384a43b85ee (patch) | |
| tree | cebea45b37b521291afaafc31a4ca9122c66b80c /source/Target/ThreadPlanPython.cpp | |
| parent | a229432d3ed05282f7cf1510a06d6d93d554c1df (diff) | |
tpm20: Harden the common device lifecycle
Mark the device as dying before teardown and destroy the character
device before freeing its private state or lock. This prevents cdev
methods from entering with a freed internal buffer or a destroyed sx.
Check the teardown state in command paths, honor failures from the cdev
private data interface, and publish teardown before waiting for the
lifecycle lock. Keep that lock across TPM retry delays so commands
cannot interpose and private state remains pinned, but abort before the
next retry once teardown begins.
Block new cdev operations after a successful Shutdown(STATE). Keep the
suspend gate and the TPM command under the same lock so a userspace
command cannot invalidate the saved state before S3 entry. Clear the
gate only after Startup(STATE) succeeds.
Keep entropy harvesting scheduled after a transient command or suspend
failure, but stop it while suspended or once teardown begins. Queue the
next timeout while holding the lifecycle lock so release cannot miss a
concurrent requeue.
Validated on two TPM 2.0 FIFO systems. Each completed five device
suspend/resume cycles, rejected both new and already-open cdev
operations with EBUSY while suspended, completed 200 concurrent PCR
reads, and detached cleanly while four PCR readers were active. A
ThinkPad P51 also completed a full S3 cycle with PCR 0 unchanged and
50 successful reads after resume.
Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59240
Diffstat (limited to 'source/Target/ThreadPlanPython.cpp')
0 files changed, 0 insertions, 0 deletions
