On Mon, 11 Sep 2023 16:57:39 +0100, Zenghui Yu <zenghui.yu@xxxxxxxxx> wrote: > > On 2023/9/11 02:18, Marc Zyngier wrote: > > On Sun, 10 Sep 2023 17:25:36 +0100, > > Zenghui Yu <zenghui.yu@xxxxxxxxx> wrote: > >> > >> Hi Marc, > >> > >> I asked because it seems that in kvm/arm64 we always use > >> kvm_get_vcpu(kvm, i) to obtain the kvm_vcpu pointer, even if *i* is > >> sometimes essentially provided by userspace.. > > > > Huh, this is incredibly dodgy. I had a go at a few occurrences (see > > below), but this is hardly a complete list. > > Another case is all kvm_get_vcpu(kvm, target_addr) in the vgic-its > emulation code. As we expose GITS_TYPER.PTA=0 to guest, which indicates > that the target address corresponds to the PE number specified by > GICR_TYPER.Processor_Number, which is now encoded as vcpu->vcpu_id. Yup, that's indeed missing. I'm going to hack kvmtool to generate stupid vcpu_ids and see what explodes... Thanks, M. -- Without deviation from the norm, progress is not possible.