]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: arm64: vgic: Add more checks when restoring ITS tables
authorRicardo Koller <ricarkol@google.com>
Tue, 10 May 2022 00:16:31 +0000 (17:16 -0700)
committerMarc Zyngier <maz@kernel.org>
Mon, 16 May 2022 12:58:04 +0000 (13:58 +0100)
commit243b1f6c8f0748bd7b03eab17323f1187e580771
treec8b878f144b781b04014f78483bb18a7b8046a18
parentcafe7e544d4979da222eaff12141ecac07901b9c
KVM: arm64: vgic: Add more checks when restoring ITS tables

Try to improve the predictability of ITS save/restores (and debuggability
of failed ITS saves) by failing early on restore when trying to read
corrupted tables.

Restoring the ITS tables does some checks for corrupted tables, but not as
many as in a save: an overflowing device ID will be detected on save but
not on restore.  The consequence is that restoring a corrupted table won't
be detected until the next save; including the ITS not working as expected
after the restore.  As an example, if the guest sets tables overlapping
each other, which would most likely result in some corrupted table, this is
what we would see from the host point of view:

guest sets base addresses that overlap each other
save ioctl
restore ioctl
save ioctl (fails)

Ideally, we would like the first save to fail, but overlapping tables could
actually be intended by the guest. So, let's at least fail on the restore
with some checks: like checking that device and event IDs don't overflow
their tables.

Signed-off-by: Ricardo Koller <ricarkol@google.com>
Reviewed-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220510001633.552496-3-ricarkol@google.com
arch/arm64/kvm/vgic/vgic-its.c