]> git.baikalelectronics.ru Git - kernel.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)
commit270e5f87fe191663a742b636de31690207b16198
treec8b878f144b781b04014f78483bb18a7b8046a18
parent8c3856ae5d7479c32d81dbf9c2d840d7d63d3c70
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