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] [day] [month] [year] [list]
Message-ID: <7151fc11-b434-1114-cbd0-023b0b8ca6d3@redhat.com>
Date:   Wed, 25 Sep 2019 15:15:54 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        Radim Krčmář <rkrcmar@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Jim Mattson <jmattson@...gle.com>,
        Thomas Huth <thuth@...hat.com>,
        Andrew Jones <drjones@...hat.com>,
        Cornelia Huck <cohuck@...hat.com>
Subject: Re: [PATCH] KVM: selftests: fix ucall on x86

On 25/09/19 15:12, Vitaly Kuznetsov wrote:
> After commit e8bb4755eea2("KVM: selftests: Split ucall.c into architecture
> specific files") selftests which use ucall on x86 started segfaulting and
> apparently it's gcc to blame: it "optimizes" ucall() function throwing away
> va_start/va_end part because it thinks the structure is not being used.
> Previously, it couldn't do that because the there was also MMIO version and
> the decision which particular implementation to use was done at runtime.
> 
> With older gccs it's possible to solve the problem by adding 'volatile'
> to 'struct ucall' but at least with gcc-8.3 this trick doesn't work.
> 
> 'memory' clobber seems to do the job.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> ---
> s390 should, in theory, have the same problem. Thomas, Cornelia, could
> you please take a look? Thanks!
> ---
>  tools/testing/selftests/kvm/lib/x86_64/ucall.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/ucall.c b/tools/testing/selftests/kvm/lib/x86_64/ucall.c
> index 4bfc9a90b1de..da4d89ad5419 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/ucall.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/ucall.c
> @@ -32,7 +32,7 @@ void ucall(uint64_t cmd, int nargs, ...)
>  	va_end(va);
>  
>  	asm volatile("in %[port], %%al"
> -		: : [port] "d" (UCALL_PIO_PORT), "D" (&uc) : "rax");
> +		: : [port] "d" (UCALL_PIO_PORT), "D" (&uc) : "rax", "memory");
>  }
>  
>  uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
> 

Queued, thanks.  s390 already clobbers memory.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ