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]
Date:   Fri, 15 Oct 2021 18:06:21 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Oliver Upton <oupton@...gle.com>,
        Sean Christopherson <seanjc@...gle.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: Account for 32-bit kernels when handling
 address in TSC attrs

On 11/10/21 16:35, Oliver Upton wrote:
> On Thu, Oct 7, 2021 at 6:16 PM Sean Christopherson <seanjc@...gle.com> wrote:
>>
>> When handling TSC attributes, cast the userspace provided virtual address
>> to an unsigned long before casting it to a pointer to fix warnings on
>> 32-bit kernels due to casting a 64-bit integer to a 32-bit pointer.
>>
>> Add a check that the truncated address matches the original address, e.g.
>> to prevent userspace specifying garbage in bits 63:32.
>>
>>    arch/x86/kvm/x86.c: In function ‘kvm_arch_tsc_get_attr’:
>>    arch/x86/kvm/x86.c:4947:22: error: cast to pointer from integer of different size
>>     4947 |  u64 __user *uaddr = (u64 __user *)attr->addr;
>>          |                      ^
>>    arch/x86/kvm/x86.c: In function ‘kvm_arch_tsc_set_attr’:
>>    arch/x86/kvm/x86.c:4967:22: error: cast to pointer from integer of different size
>>     4967 |  u64 __user *uaddr = (u64 __user *)attr->addr;
>>          |                      ^
>>
>> Cc: Oliver Upton <oupton@...gle.com>
>> Fixes: 469fde25e680 ("KVM: x86: Expose TSC offset controls to userspace")
>> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
>> ---
>>   arch/x86/kvm/x86.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
> 
> Reviewed-by: Oliver Upton <oupton@...gle.com>
> 

Squashed, thanks.

Paolo

Powered by blists - more mailing lists