From nobody Sun Apr 26 12:18:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD0CCCA479 for ; Tue, 28 Jun 2022 13:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346557AbiF1NcY (ORCPT ); Tue, 28 Jun 2022 09:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237387AbiF1Nbf (ORCPT ); Tue, 28 Jun 2022 09:31:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B507A2A71F for ; Tue, 28 Jun 2022 06:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656423064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u55Q3Jca+qOXXIBqB4TXnLGHs1HcaTUob8yIUpePALU=; b=Oo5Q5GO05igY7JAInvgV1GFWRYtG1zmsJEq1IqSdfaGJPvCCn4zqjTTeosmBWLPMrhL7sB o90BcRVm0ieMgzxV6zfJG59lRm9SQd6JDebJhsHCCM2Od+UInqSh2oRI79DfSr1u1diWf5 Shoh0PPis6rNnbLRfNrXPAObpUqpfA0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-325-i5Y-yA-hNpycuk-FDu2J_Q-1; Tue, 28 Jun 2022 09:31:00 -0400 X-MC-Unique: i5Y-yA-hNpycuk-FDu2J_Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A4D5811E80; Tue, 28 Jun 2022 13:31:00 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1503E2026D07; Tue, 28 Jun 2022 13:30:57 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: x86: Fully initialize 'struct kvm_lapic_irq' in kvm_pv_kick_cpu_op() Date: Tue, 28 Jun 2022 15:30:57 +0200 Message-Id: <20220628133057.107344-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 'vector' and 'trig_mode' fields of 'struct kvm_lapic_irq' are left uninitialized in kvm_pv_kick_cpu_op(). While these fields are normally not needed for APIC_DM_REMRD, they're still referenced by __apic_accept_irq() for trace_kvm_apic_accept_irq(). Fully initialize the structure to avoid consuming random stack memory. Fixes: a183b638b61c ("KVM: x86: make apic_accept_irq tracepoint more generi= c") Reported-by: syzbot+d6caa905917d353f0d07@syzkaller.appspotmail.com Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/x86.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 567d13405445..8a98608dad4f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9340,15 +9340,17 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vc= pu, gpa_t paddr, */ static void kvm_pv_kick_cpu_op(struct kvm *kvm, int apicid) { - struct kvm_lapic_irq lapic_irq; - - lapic_irq.shorthand =3D APIC_DEST_NOSHORT; - lapic_irq.dest_mode =3D APIC_DEST_PHYSICAL; - lapic_irq.level =3D 0; - lapic_irq.dest_id =3D apicid; - lapic_irq.msi_redir_hint =3D false; + struct kvm_lapic_irq lapic_irq =3D { + .vector =3D 0, + .delivery_mode =3D APIC_DM_REMRD, + .dest_mode =3D APIC_DEST_PHYSICAL, + .level =3D false, + .trig_mode =3D 0, + .shorthand =3D APIC_DEST_NOSHORT, + .dest_id =3D apicid, + .msi_redir_hint =3D false + }; =20 - lapic_irq.delivery_mode =3D APIC_DM_REMRD; kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL); } =20 --=20 2.35.3