From nobody Mon Sep 29 22:45:03 2025 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 C2DABC28B2C for ; Mon, 15 Aug 2022 21:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243815AbiHOV5B (ORCPT ); Mon, 15 Aug 2022 17:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348137AbiHOVyS (ORCPT ); Mon, 15 Aug 2022 17:54:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA9A108F9C; Mon, 15 Aug 2022 12:33:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BDA26113B; Mon, 15 Aug 2022 19:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B52FC433D7; Mon, 15 Aug 2022 19:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592011; bh=VaPQ+O2Fw42bwODM7MNZEwPN+DIlDmoE8rDjqD4UN/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qWdQZJR87KSZfmBn8VQ8a10XyQOE/+wzxPU8A2XeXTFvkqG2LQUTMEyhd5+v956HK xmir1SIxVzTCvNVPn5iRNLLvBWvjLIlwAO3EqaHrLfwro78qZfSabnq/DaLpjHpuam spsWwDkl6lDP3CbQ9W6c0wEhw56uHgDtoIzwvnDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+e54f930ed78eb0f85281@syzkaller.appspotmail.com, Coleman Dietsch , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.19 0044/1157] KVM: x86/xen: Initialize Xen timer only once Date: Mon, 15 Aug 2022 19:50:00 +0200 Message-Id: <20220815180441.206951782@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Coleman Dietsch commit af735db31285fa699384c649be72a9f32ecbb665 upstream. Add a check for existing xen timers before initializing a new one. Currently kvm_xen_init_timer() is called on every KVM_XEN_VCPU_ATTR_TYPE_TIMER, which is causing the following ODEBUG crash when vcpu->arch.xen.timer is already set. ODEBUG: init active (active state 0) object type: hrtimer hint: xen_timer_callbac0 RIP: 0010:debug_print_object+0x16e/0x250 lib/debugobjects.c:502 Call Trace: __debug_object_init debug_hrtimer_init debug_init hrtimer_init kvm_xen_init_timer kvm_xen_vcpu_set_attr kvm_arch_vcpu_ioctl kvm_vcpu_ioctl vfs_ioctl Fixes: 536395260582 ("KVM: x86/xen: handle PV timers oneshot mode") Cc: stable@vger.kernel.org Link: https://syzkaller.appspot.com/bug?id=3D8234a9dfd3aafbf092cc5a7cd9842e= 3ebc45fc42 Reported-by: syzbot+e54f930ed78eb0f85281@syzkaller.appspotmail.com Signed-off-by: Coleman Dietsch Reviewed-by: Sean Christopherson Message-Id: <20220808190607.323899-2-dietschc@csp.edu> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/xen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -713,7 +713,9 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcp break; } vcpu->arch.xen.timer_virq =3D data->u.timer.port; - kvm_xen_init_timer(vcpu); + + if (!vcpu->arch.xen.timer.function) + kvm_xen_init_timer(vcpu); =20 /* Restart the timer if it's set */ if (data->u.timer.expires_ns)