git: 2feea221b248 - main - bhyve: don't crash when guest writes TPM int_enable register
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Oct 2024 12:06:48 UTC
The branch main has been updated by corvink:
URL: https://cgit.FreeBSD.org/src/commit/?id=2feea221b2480f9f97b3bc0f47510b5bdec96b79
commit 2feea221b2480f9f97b3bc0f47510b5bdec96b79
Author: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
AuthorDate: 2024-09-09 08:41:31 +0000
Commit: Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2024-10-22 12:04:21 +0000
bhyve: don't crash when guest writes TPM int_enable register
FreeBSD's own TPM driver writes 0 to the INT_ENABLE register during
attach, making sure interrupts are off. bhyve really shouldn't kill the
VM when that happens just because it doesn't support TPM interrupts.
Even if a guest was trying to enable interrupts, we should just ignore
it like real TPM hardware would.
Reviewed by: corvink
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D46562
---
usr.sbin/bhyve/tpm_intf_crb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/usr.sbin/bhyve/tpm_intf_crb.c b/usr.sbin/bhyve/tpm_intf_crb.c
index 0f9a8d1dd53b..d4ac2b47d28a 100644
--- a/usr.sbin/bhyve/tpm_intf_crb.c
+++ b/usr.sbin/bhyve/tpm_intf_crb.c
@@ -337,6 +337,10 @@ tpm_crb_mem_handler(struct vcpu *vcpu __unused, const int dir,
break;
}
+ case offsetof(struct tpm_crb_regs, int_enable):
+ /* No interrupt support. Ignore writes to int_enable. */
+ break;
+
case offsetof(struct tpm_crb_regs, ctrl_start): {
union tpm_crb_reg_ctrl_start start;