From: Paolo Bonzini <pbonzini@redhat.com>
To: Oliver Upton <oupton@google.com>,
Sean Christopherson <seanjc@google.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Account for 32-bit kernels when handling address in TSC attrs
Date: Fri, 15 Oct 2021 18:06:21 +0200 [thread overview]
Message-ID: <5785637f-2b1a-b4c7-1f9e-67711f284264@redhat.com> (raw)
In-Reply-To: <CAOQ_Qsj9yiChnBZmotdYFYgsd=C0J5XXR8mthdiC+iXX22F7jw@mail.gmail.com>
On 11/10/21 16:35, Oliver Upton wrote:
> On Thu, Oct 7, 2021 at 6:16 PM Sean Christopherson <seanjc@google.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@google.com>
>> Fixes: 469fde25e680 ("KVM: x86: Expose TSC offset controls to userspace")
>> Signed-off-by: Sean Christopherson <seanjc@google.com>
>> ---
>> arch/x86/kvm/x86.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>
> Reviewed-by: Oliver Upton <oupton@google.com>
>
Squashed, thanks.
Paolo
prev parent reply other threads:[~2021-10-15 16:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 23:16 [PATCH] KVM: x86: Account for 32-bit kernels when handling address in TSC attrs Sean Christopherson
2021-10-11 14:35 ` Oliver Upton
2021-10-15 16:06 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5785637f-2b1a-b4c7-1f9e-67711f284264@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oupton@google.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).