Page MenuHomeFreeBSD

bhyve: do not hold CRB mutex when executing TPM commands
ClosedPublic

Authored by corvink on Jun 23 2023, 9:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 24, 1:14 AM
Unknown Object (File)
Thu, Apr 24, 1:13 AM
Unknown Object (File)
Wed, Apr 23, 1:34 PM
Unknown Object (File)
Sun, Apr 20, 10:42 AM
Unknown Object (File)
Sat, Apr 19, 3:39 PM
Unknown Object (File)
Mon, Apr 14, 10:43 AM
Unknown Object (File)
Mon, Apr 14, 8:03 AM
Unknown Object (File)
Mon, Apr 14, 3:46 AM
Subscribers

Details

Summary

TPM commands can take up to several seconds to execute. If we hold the
CRB mutex while executing the command, MMIO accesses could be blocked
for a long time. Therefore, just copy all required values and work on
the copied values.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 52257
Build 49148: arc lint + arc unit

Event Timeline

usr.sbin/bhyve/tpm_intf_crb.c
219

Now it's possible for the thread to miss wakeups. Suppose the thread is processing a command, and tpm_crb_deinit() is called while the lock is dropped. The thread will reacquire the lock and go to sleep without checking crb->closing.

  • fix race on thread signalling
This revision is now accepted and ready to land.Jul 4 2023, 3:45 PM