[lkml]   [2020]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/2] KVM: arm64: vgic: Forbid invalid userspace Redistributor accesses
Hi Zenghui,

On 2020-11-13 14:28, Zenghui Yu wrote:
> It's expected that users will access registers in the redistributor
> *if*
> the RD has been initialized properly. Unfortunately userspace can be
> bogus
> enough to access registers before setting the RD base address, and KVM
> implicitly allows it (we handle the access anyway, regardless of
> whether
> the base address is set).
> Bad thing happens when we're handling the user read of GICR_TYPER. We
> end
> up with an oops when deferencing the unset rdreg...
> gpa_t last_rdist_typer = rdreg->base + GICR_TYPER +
> (rdreg->free_index - 1) * KVM_VGIC_V3_REDIST_SIZE;
> Fix this issue by informing userspace what had gone wrong (-ENXIO).

I'm worried about the "implicit" aspect of the access that this patch
now forbids.

The problem is that the existing documentation doesn't cover this case,
and -ENXIO's "Getting or setting this register is not yet supported"
is way too vague. There is a precedent with the ITS, but that's
as well. Also, how about v2? If that's the wasy we are going to fix
we also nned to beef up the documentation.

Of course, the other horrible way to address the issue is to return a
that doesn't have the Last bit set, since we can't synthetise it. It
change the userspace API, and I can even find some (admittedly twisted)
logic to it (since there is no base address, there is no last RD...).


Jazz is not dead. It just smells funny...

 \ /
  Last update: 2020-11-15 18:05    [W:0.059 / U:3.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site