Skip to content

Commit 9ce754e

Browse files
mjbommarMarc Zyngier
authored andcommitted
KVM: arm64: vgic-its: Reject restored DTE with out-of-range num_eventid_bits
Userspace can restore an ITS Device Table Entry whose Size field encodes more EventID bits than the virtual ITS supports. The live MAPD path rejects that state, but vgic_its_restore_dte() accepts it and stores the out-of-range value in dev->num_eventid_bits. Reject restored DTEs with num_eventid_bits > VITS_TYPER_IDBITS before allocating the device. This mirrors the MAPD check and prevents the restored state from reaching vgic_its_restore_itt(), where the unchecked value can be converted into an oversized scan_its_table() range. Fixes: 57a9a11 ("KVM: arm64: vgic-its: Device table save/restore") Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Link: https://lore.kernel.org/r/20260519132519.2142458-1-michael.bommarito@gmail.com Signed-off-by: Marc Zyngier <maz@kernel.org> Cc: stable@vger.kernel.org
1 parent effc0a3 commit 9ce754e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/arm64/kvm/vgic/vgic-its.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,10 @@ static int vgic_its_restore_dte(struct vgic_its *its, u32 id,
23072307
/* dte entry is valid */
23082308
offset = (entry & KVM_ITS_DTE_NEXT_MASK) >> KVM_ITS_DTE_NEXT_SHIFT;
23092309

2310+
/* Mimic the MAPD behaviour and reject invalid EID bits. */
2311+
if (num_eventid_bits > VITS_TYPER_IDBITS)
2312+
return -EINVAL;
2313+
23102314
if (!vgic_its_check_id(its, baser, id, NULL))
23112315
return -EINVAL;
23122316

0 commit comments

Comments
 (0)