Hi Marc, On Wed, Jul 6, 2022 at 9:43 AM Marc Zyngier <maz@xxxxxxxxxx> wrote: > > Make sure the check occurs on every paths where we can pick > a sysreg from userspace, including the GICv3 paths. > > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> > --- > arch/arm64/kvm/sys_regs.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > index 0fbdb21a3600..89e7eddea937 100644 > --- a/arch/arm64/kvm/sys_regs.c > +++ b/arch/arm64/kvm/sys_regs.c > @@ -2656,6 +2656,10 @@ const struct sys_reg_desc *get_reg_by_id(u64 id, > { > struct sys_reg_params params; > > + /* 64 bit is the only way */ > + if (KVM_REG_SIZE(id) != sizeof(__u64)) > + return NULL; This doesn't seem to be necessary since the equivalent check is done by index_to_params(). Thank you, Reiji > + > if (!index_to_params(id, ¶ms)) > return NULL; > > @@ -2871,9 +2875,6 @@ int kvm_arm_sys_reg_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg > if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX) > return demux_c15_get(reg->id, uaddr); > > - if (KVM_REG_SIZE(reg->id) != sizeof(__u64)) > - return -ENOENT; > - > err = get_invariant_sys_reg(reg->id, uaddr); > if (err != -ENOENT) > return err; > @@ -2906,9 +2907,6 @@ int kvm_arm_sys_reg_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg > if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX) > return demux_c15_set(reg->id, uaddr); > > - if (KVM_REG_SIZE(reg->id) != sizeof(__u64)) > - return -ENOENT; > - > err = set_invariant_sys_reg(reg->id, uaddr); > if (err != -ENOENT) > return err; > -- > 2.34.1 > > _______________________________________________ > kvmarm mailing list > kvmarm@xxxxxxxxxxxxxxxxxxxxx > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm