All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Longpeng(Mike)" <longpeng2@huawei.com>, rkrcmar@redhat.com
Cc: tglx@linutronix.de, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, weidong.huang@huawei.com,
	arei.gonglei@huawei.com, wangxinxin.wang@huawei.com
Subject: Re: [PATCH] KVM: X86: init irq->level in kvm_pv_kick_cpu_op
Date: Wed, 2 Aug 2017 10:14:25 +0200	[thread overview]
Message-ID: <cb2e6cb9-8e8b-209c-b81e-2e7ea894c55c@redhat.com> (raw)
In-Reply-To: <1501644051-211436-1-git-send-email-longpeng2@huawei.com>

On 02/08/2017 05:20, Longpeng(Mike) wrote:
> 'lapic_irq' is a local variable and its 'level' field isn't
> initialized, so 'level' is random, it doesn't matter but
> makes UBSAN unhappy:
> 
> UBSAN: Undefined behaviour in .../lapic.c:...
> load of value 10 is not a valid value for type '_Bool'
> ...
> Call Trace:
>  [<ffffffff81f030b6>] dump_stack+0x1e/0x20
>  [<ffffffff81f03173>] ubsan_epilogue+0x12/0x55
>  [<ffffffff81f03b96>] __ubsan_handle_load_invalid_value+0x118/0x162
>  [<ffffffffa1575173>] kvm_apic_set_irq+0xc3/0xf0 [kvm]
>  [<ffffffffa1575b20>] kvm_irq_delivery_to_apic_fast+0x450/0x910 [kvm]
>  [<ffffffffa15858ea>] kvm_irq_delivery_to_apic+0xfa/0x7a0 [kvm]
>  [<ffffffffa1517f4e>] kvm_emulate_hypercall+0x62e/0x760 [kvm]
>  [<ffffffffa113141a>] handle_vmcall+0x1a/0x30 [kvm_intel]
>  [<ffffffffa114e592>] vmx_handle_exit+0x7a2/0x1fa0 [kvm_intel]
> ...
> 
> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
> ---
>  arch/x86/kvm/x86.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 6c97c82..b411f92 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -6215,6 +6215,7 @@ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid)
>  
>  	lapic_irq.shorthand = 0;
>  	lapic_irq.dest_mode = 0;
> +	lapic_irq.level = 0;
>  	lapic_irq.dest_id = apicid;
>  	lapic_irq.msi_redir_hint = false;

Looks good.  Thanks,

Paolo

  reply	other threads:[~2017-08-02  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02  3:20 [PATCH] KVM: X86: init irq->level in kvm_pv_kick_cpu_op Longpeng(Mike)
2017-08-02  8:14 ` Paolo Bonzini [this message]
2017-08-02 20:30 ` Radim Krčmář

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=cb2e6cb9-8e8b-209c-b81e-2e7ea894c55c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wangxinxin.wang@huawei.com \
    --cc=weidong.huang@huawei.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.