Re: [PATCH 6/7] KVM: TDX: Handle TDX PV port I/O hypercall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>+static int tdx_emulate_io(struct kvm_vcpu *vcpu)
>+{
>+	struct x86_emulate_ctxt *ctxt = vcpu->arch.emulate_ctxt;
>+	unsigned long val = 0;
>+	unsigned int port;
>+	int size, ret;
>+	bool write;

..

>+
>+	++vcpu->stat.io_exits;
>+
>+	size = tdvmcall_a0_read(vcpu);
>+	write = tdvmcall_a1_read(vcpu);

a1 (i.e., R13) should be either 0 or 1. Other values are reserved according to
the GHCI spec. It is not appropriate to cast it to a boolean. For example, if
R13=2, KVM shouldn't treat it as a write request; instead, this request should
be rejected.

>+	port = tdvmcall_a2_read(vcpu);
>+
>+	if (size != 1 && size != 2 && size != 4) {
>+		tdvmcall_set_return_code(vcpu, TDVMCALL_STATUS_INVALID_OPERAND);
>+		return 1;
>+	}




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux