lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f1a56d20-823b-e878-e903-ff87b3c51229@de.ibm.com>
Date:   Fri, 24 Jan 2020 19:33:27 +0100
From:   Christian Borntraeger <borntraeger@...ibm.com>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Ben Gardon <bgardon@...gle.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org, linux-kselftest@...r.kernel.org
Cc:     Cannon Matthews <cannonmatthews@...gle.com>,
        Peter Xu <peterx@...hat.com>,
        Andrew Jones <drjones@...hat.com>,
        Peter Shier <pshier@...gle.com>,
        Oliver Upton <oupton@...gle.com>,
        Marc Zyngier <Marc.Zyngier@....com>,
        Cornelia Huck <cohuck@...hat.com>,
        Thomas Huth <thuth@...hat.com>
Subject: Re: [PATCH v4 06/10] KVM: selftests: Add support for vcpu_args_set to
 aarch64 and s390x



On 24.01.20 10:03, Paolo Bonzini wrote:
> CCing Marc, Conny and Christian (plus Thomas and Drew who were already
> in the list) for review.

CC Thomas Huth,

> 
> Thanks,
> 
> Paolo
> 
> On 23/01/20 19:04, Ben Gardon wrote:
>> Currently vcpu_args_set is only implemented for x86. This makes writing
>> tests with multiple vCPUs difficult as each guest vCPU must either a.)
>> do the same thing or b.) derive some kind of unique token from it's
>> registers or the architecture. To simplify the process of writing tests
>> with multiple vCPUs for s390 and aarch64, add set args functions for
>> those architectures.
[...]
>>  .../selftests/kvm/lib/s390x/processor.c       | 35 +++++++++++++++++++
[...]
>> --- a/tools/testing/selftests/kvm/lib/s390x/processor.c
>> +++ b/tools/testing/selftests/kvm/lib/s390x/processor.c
>> @@ -269,6 +269,41 @@ void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code)
>>  	run->psw_addr = (uintptr_t)guest_code;
>>  }
>>  
>> +/* VM VCPU Args Set
>> + *
>> + * Input Args:
>> + *   vm - Virtual Machine
>> + *   vcpuid - VCPU ID
>> + *   num - number of arguments
>> + *   ... - arguments, each of type uint64_t
>> + *
>> + * Output Args: None
>> + *
>> + * Return: None
>> + *
>> + * Sets the first num function input arguments to the values
>> + * given as variable args.  Each of the variable args is expected to
>> + * be of type uint64_t. The registers set by this function are r2-r6.
>> + */
>> +void vcpu_args_set(struct kvm_vm *vm, uint32_t vcpuid, unsigned int num, ...)
>> +{
>> +	va_list ap;
>> +	struct kvm_regs regs;
>> +
>> +	TEST_ASSERT(num >= 1 && num <= 5, "Unsupported number of args,\n"
>> +		    "  num: %u\n",
>> +		    num);
>> +
>> +	va_start(ap, num);
>> +	vcpu_regs_get(vm, vcpuid, &regs);
>> +
>> +	for (i = 0; i < num; i++)
>> +		regs.gprs[i + 2] = va_arg(ap, uint64_t);
>> +
>> +	vcpu_regs_set(vm, vcpuid, &regs);
>> +	va_end(ap);
>> +}
>> +
>>  void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
>>  {
>>  	struct vcpu *vcpu = vm->vcpu_head;
>>
> 

Untested but the logic looks sane according to the ELF ABI. 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ