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: <09a6a16a-34db-38df-4632-ddf861afece6@redhat.com>
Date:   Thu, 5 Mar 2020 15:29:36 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <sean.j.christopherson@...el.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
Subject: Re: [PATCH] KVM: x86: Fix warning due to implicit truncation on
 32-bit KVM

On 05/03/20 01:24, Sean Christopherson wrote:
> Explicitly cast the integer literal to an unsigned long when stuffing a
> non-canonical value into the host virtual address during private memslot
> deletion.  The explicit cast fixes a warning that gets promoted to an
> error when running with KVM's newfangled -Werror setting.
> 
>   arch/x86/kvm/x86.c:9739:9: error: large integer implicitly truncated
>   to unsigned type [-Werror=overflow]
> 
> Fixes: a3e967c0b87d3 ("KVM: Terminate memslot walks via used_slots"
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
>  arch/x86/kvm/x86.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ba4d476b79ad..fa03f31ab33c 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -9735,8 +9735,12 @@ int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
>  		if (!slot || !slot->npages)
>  			return 0;
>  
> -		/* Stuff a non-canonical value to catch use-after-delete. */
> -		hva = 0xdeadull << 48;
> +		/*
> +		 * Stuff a non-canonical value to catch use-after-delete.  This
> +		 * ends up being 0 on 32-bit KVM, but there's no better
> +		 * alternative.
> +		 */
> +		hva = (unsigned long)(0xdeadull << 48);
>  		old_npages = slot->npages;
>  	}
>  
> 

Queued, thanks.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ