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: <3fe02090-14c7-23eb-e096-ba3d463884cf@oracle.com>
Date:   Mon, 8 Feb 2021 20:40:01 +0000
From:   Joao Martins <joao.m.martins@...cle.com>
To:     Sean Christopherson <seanjc@...gle.com>,
        Paolo Bonzini <pbonzini@...hat.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, David Woodhouse <dwmw@...zon.co.uk>
Subject: Re: [PATCH] KVM: x86/xen: Use hva_t for holding hypercall page
 address



On 2/8/21 8:15 PM, Sean Christopherson wrote:
> Use hva_t, a.k.a. unsigned long, for the local variable that holds the
> hypercall page address.  On 32-bit KVM, gcc complains about using a u64
> due to the implicit cast from a 64-bit value to a 32-bit pointer.
> 
>   arch/x86/kvm/xen.c: In function ‘kvm_xen_write_hypercall_page’:
>   arch/x86/kvm/xen.c:300:22: error: cast to pointer from integer of
>                              different size [-Werror=int-to-pointer-cast]
>   300 |   page = memdup_user((u8 __user *)blob_addr, PAGE_SIZE);
> 
> Cc: Joao Martins <joao.m.martins@...cle.com>
> Cc: David Woodhouse <dwmw@...zon.co.uk>
> Fixes: 23200b7a30de ("KVM: x86/xen: intercept xen hypercalls if enabled")
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>

Reviewed-by: Joao Martins <joao.m.martins@...cle.com>

> ---
>  arch/x86/kvm/xen.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> index 2cee0376455c..deda1ba8c18a 100644
> --- a/arch/x86/kvm/xen.c
> +++ b/arch/x86/kvm/xen.c
> @@ -286,8 +286,12 @@ int kvm_xen_write_hypercall_page(struct kvm_vcpu *vcpu, u64 data)
>  				return 1;
>  		}
>  	} else {
> -		u64 blob_addr = lm ? kvm->arch.xen_hvm_config.blob_addr_64
> -				   : kvm->arch.xen_hvm_config.blob_addr_32;
> +		/*
> +		 * Note, truncation is a non-issue as 'lm' is guaranteed to be
> +		 * false for a 32-bit kernel, i.e. when hva_t is only 4 bytes.
> +		 */
> +		hva_t blob_addr = lm ? kvm->arch.xen_hvm_config.blob_addr_64
> +				     : kvm->arch.xen_hvm_config.blob_addr_32;
>  		u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
>  				  : kvm->arch.xen_hvm_config.blob_size_32;
>  		u8 *page;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ