All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org
Subject: Re: [bug report] KVM: x86: avoid incorrect writes to host MSR_IA32_SPEC_CTRL
Date: Mon, 27 Jan 2020 10:12:56 -0800	[thread overview]
Message-ID: <20200127181255.GA2523@linux.intel.com> (raw)
In-Reply-To: <20200127060305.jlq5uv6tu67tsbv4@kili.mountain>

On Mon, Jan 27, 2020 at 09:04:22AM +0300, Dan Carpenter wrote:
> Hello Paolo Bonzini,
> 
> The patch e71ae535bc24: "KVM: x86: avoid incorrect writes to host
> MSR_IA32_SPEC_CTRL" from Jan 20, 2020, leads to the following static
> checker warning:
> 
> 	arch/x86/kvm/vmx/vmx.c:2001 vmx_set_msr()
> 	warn: maybe use && instead of &
> 
> arch/x86/kvm/vmx/vmx.c
>   1994                  vmx->msr_ia32_umwait_control = data;
>   1995                  break;
>   1996          case MSR_IA32_SPEC_CTRL:
>   1997                  if (!msr_info->host_initiated &&
>   1998                      !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL))
>   1999                          return 1;
>   2000  
>   2001                  if (data & ~kvm_spec_ctrl_valid_bits(vcpu))
>                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> This seems wrong.  kvm_spec_ctrl_valid_bits() returns a bool so this
> is either 0xffffffff or 0xfffffffe.  data is a u64.
> 
>   2002                          return 1;
>   2003  
>   2004                  vmx->spec_ctrl = data;
>   2005                  if (!data)
>   2006                          break;
>   2007  
>   2008                  /*
>   2009                   * For non-nested:

Paolo already had to put on the cone of shame for this one :-)

https://lkml.kernel.org/r/6b725990-f0c2-6577-be7e-44e101e540b5@redhat.com

      parent reply	other threads:[~2020-01-27 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27  6:04 [bug report] KVM: x86: avoid incorrect writes to host MSR_IA32_SPEC_CTRL Dan Carpenter
2020-01-27  6:08 ` Dan Carpenter
2020-01-27 18:12 ` 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=20200127181255.GA2523@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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.