Re: [PATCH v2] KVM: selftests: Add a test for the KVM_S390_MEM_OP ioctl
From: Janosch Frank
Date: Thu Aug 29 2019 - 08:21:39 EST
On 8/29/19 2:14 PM, Thomas Huth wrote:
> Check that we can write and read the guest memory with this s390x
> ioctl, and that some error cases are handled correctly.
>
> Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
> ---
> v2: Check the ioctl also with "size" set to 0
>
[...]
> +
> + /* Zero size: */
> + ksmo.gaddr = (uintptr_t)mem1;
> + ksmo.flags = 0;
> + ksmo.size = 0;
> + ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE;
> + ksmo.buf = (uintptr_t)mem1;
> + ksmo.ar = 0;
> + rv = _vcpu_ioctl(vm, VCPU_ID, KVM_S390_MEM_OP, &ksmo);
> + TEST_ASSERT(rv == -1, "ioctl allows 0 as size");
Test for errno == -EINVAL?
> +
> + /* Bad flags: */
> + ksmo.gaddr = (uintptr_t)mem1;
> + ksmo.flags = -1;
> + ksmo.size = maxsize;
> + ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE;
> + ksmo.buf = (uintptr_t)mem1;
> + ksmo.ar = 0;
> + rv = _vcpu_ioctl(vm, VCPU_ID, KVM_S390_MEM_OP, &ksmo);
> + TEST_ASSERT(rv == -1 && errno == EINVAL, "ioctl allows all flags?");
> +
> + /* Bad operation: */
> + ksmo.gaddr = (uintptr_t)mem1;
> + ksmo.flags = 0;
> + ksmo.size = maxsize;
> + ksmo.op = -1;
> + ksmo.buf = (uintptr_t)mem1;
> + ksmo.ar = 0;
> + rv = _vcpu_ioctl(vm, VCPU_ID, KVM_S390_MEM_OP, &ksmo);
> + TEST_ASSERT(rv == -1 && errno == EINVAL, "ioctl allows all flags?");
Wrong report string
Attachment:
signature.asc
Description: OpenPGP digital signature