From: Sean Christopherson <seanjc@google.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: rientjes@google.com, kvm@vger.kernel.org
Subject: Re: [bug report] KVM: SVM: prevent DBG_DECRYPT and DBG_ENCRYPT overflow
Date: Wed, 5 May 2021 21:39:01 +0000 [thread overview]
Message-ID: <YJMQdQu4LRMd9lSi@google.com> (raw)
In-Reply-To: <YIpeFsdjT5Fz5FWZ@mwanda>
On Thu, Apr 29, 2021, Dan Carpenter wrote:
> Hello David Rientjes,
>
> The patch b86bc2858b38: "KVM: SVM: prevent DBG_DECRYPT and
> DBG_ENCRYPT overflow" from Mar 25, 2019, leads to the following
> static checker warning:
>
> arch/x86/kvm/svm/sev.c:960 sev_dbg_crypt()
> error: uninitialized symbol 'ret'.
>
> arch/x86/kvm/svm/sev.c
> 879 static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec)
> 880 {
> 881 unsigned long vaddr, vaddr_end, next_vaddr;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> 882 unsigned long dst_vaddr;
> ^^^^^^^^^^^^^^^^^^^^^^^^
>
> These are unsigned long
>
> 883 struct page **src_p, **dst_p;
> 884 struct kvm_sev_dbg debug;
> 885 unsigned long n;
> 886 unsigned int size;
> 887 int ret;
> 888
> 889 if (!sev_guest(kvm))
> 890 return -ENOTTY;
> 891
> 892 if (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))
> 893 return -EFAULT;
> 894
> 895 if (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> But these are u64 so this could still overflow on 32 bit. Do we care?
Not really. sev_guest() will always be false for CONFIG_KVM_AMD_SEV=n, and
CONFIG_KVM_AMD_SEV is dependent on CONFIG_X86_64=y. This code is compiled for
32-bit only because everyone has been too lazy to stub out sev.c.
prev parent reply other threads:[~2021-05-05 21:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 7:19 [bug report] KVM: SVM: prevent DBG_DECRYPT and DBG_ENCRYPT overflow Dan Carpenter
2021-05-05 21:39 ` Sean Christopherson [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=YJMQdQu4LRMd9lSi@google.com \
--to=seanjc@google.com \
--cc=dan.carpenter@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=rientjes@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.