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)
Wed, May 15, 6:00 PM
Unknown Object (File)
Wed, May 15, 5:56 PM
Unknown Object (File)
Wed, May 15, 5:55 PM
Unknown Object (File)
Wed, May 15, 5:45 PM
Unknown Object (File)
Mar 9 2024, 7:43 PM
Unknown Object (File)
Mar 9 2024, 7:43 PM
Unknown Object (File)
Mar 6 2024, 3:33 AM
Unknown Object (File)
Mar 6 2024, 3:31 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