bhyve: tpm: allow the last dword of the CRB command buffer

The bounds check rejected any access ending exactly at the end of the
register block, so a four byte write at offset 0xffc was refused,
returning EINVAL and killing the VM.

MFC after: 	1 week
PR:		291063
Fixes: 		75909086a4 ("bhyve: allow read/write to full CRB buffer")
Sponsored by: 	Defenso

Signed-off-by: Quentin Thébault <[email protected]>
Reviewed-by: aokblast, kevans, markj
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2362
This commit is contained in:
Quentin Thébault authored and Kyle Evans committed 2026-09-15 09:04:28 -05:00
1 parent 602d1b994a
commit 4505445ccd
1 file changed
+1 -1
+1 -1
View File
@@ -321,7 +321,7 @@ tpm_crb_mem_handler(struct vcpu *vcpu __unused, const int dir,
crb = arg1;
off = addr - TPM_CRB_ADDRESS;
if (off > TPM_CRB_REGS_SIZE || off + size >= TPM_CRB_REGS_SIZE) {
if (off > TPM_CRB_REGS_SIZE || off + size > TPM_CRB_REGS_SIZE) {
return (EINVAL);
}