From nobody Sun Oct 5 01:50:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1757424834; cv=none; d=zohomail.com; s=zohoarc; b=RReHX+kWKlpEcrIcrA+6ERo9xI0/hbBV1kZRnHY9sSGTAUV49FfLuDAIaPpU0Z/+omb3IEX8GXZQGcdoVeDVYPJyeFJeCuSRS5Ecd9qCOkPdm6ahKN1fHZi4/J3a79DbQCzxKvdCUBD90X7FhyRnAuHAbQ1aTclygg/RgtBFUjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757424834; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=XJraZb4prTILQJ8Lr+/jGUKZZDfRbCk+1nCe8I1dRyA=; b=HkIaS7JzxYu+5KZiA4vmfm1QAJHcyCxwMygJTAQgahCM+SsiU5KW8ervzemicCd0gzjC89a1SIoi7TJm69ioVmWrrA/9AubxFPXjOvjsAs49Wk31RmswCeCSnvztOXrFv18BzBM6rTYcgKz7QycRtnU1Spo05gb4njJw2TijEpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1757424833997341.93889008928727; Tue, 9 Sep 2025 06:33:53 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 79E0941B20; Tue, 9 Sep 2025 09:33:50 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1446141B74; Tue, 9 Sep 2025 09:32:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id EF42C41B0F; Tue, 9 Sep 2025 09:32:13 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 34E4F41932 for ; Tue, 9 Sep 2025 09:32:13 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-_c27AATUPlaig80li3G0yQ-1; Tue, 09 Sep 2025 09:32:11 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48CCC19560BE for ; Tue, 9 Sep 2025 13:32:10 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.3.236]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8EAAA300070A for ; Tue, 9 Sep 2025 13:32:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757424732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XJraZb4prTILQJ8Lr+/jGUKZZDfRbCk+1nCe8I1dRyA=; b=CCdEKZ2S5RFUHyQc5SGWbmZQ9RiYCoQU+QX9M7M4NWgDOatGePrFGFrlxt2kTW0zh2LJA2 tWCLKMpHWp3TMGqd5CDD7H+b/sBgLSM3wP7VkZdgsB7l6nNk0k717xWz4nscpzfp6E2Hjg lmHrTNOEZupziDi7GZZeSVPYA1pdnqg= X-MC-Unique: _c27AATUPlaig80li3G0yQ-1 X-Mimecast-MFC-AGG-ID: _c27AATUPlaig80li3G0yQ_1757424730 To: devel@lists.libvirt.org Subject: [PATCH 2/4] ch: Make sure the cloud-hypervisor process is killed in virCHProcessStop() Date: Tue, 9 Sep 2025 15:32:00 +0200 Message-ID: <8f6c8ce7b255ad825ebe08be1e04dce0f3b270c8.1757424690.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: I2Ov4Yv1PdgF6LwZK8l-427ctTslk3L9hpsW8eVJdcA_1757424730 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ITKFYKRDIT3RY3AWFH2UGFGLUNW5KB4W X-Message-ID-Hash: ITKFYKRDIT3RY3AWFH2UGFGLUNW5KB4W X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1757424836286124100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Currently, virCHProcessStop() is called either when the cloud-hypervisor process dies gracefully (e.g. on shutdown initiated from within the guest) or when virDomainDestroy() is called (or on failed start attempt, but that's not important right now). At any rate, if the cloud-hypervisor process is running it's not a child process of libvirtd rather than the init (per virCommandDaemonize() called inside of virCHMonitorNew()). This distinction is important because virCHProcessStop() then calls virProcessAbort() thinking it'll kill the process. Well, virProcessAbort() works only on child processes. Switch to virProcessKillPainfully() which does work in such cases. Signed-off-by: Michal Privoznik --- src/ch/ch_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 5195d3f5da..6b779285e1 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -1028,7 +1028,7 @@ virCHProcessStop(virCHDriver *driver, virErrorPreserveLast(&orig_err); =20 if (priv->monitor) { - virProcessAbort(vm->pid); + virProcessKillPainfully(vm->pid, true); g_clear_pointer(&priv->monitor, virCHMonitorClose); } =20 --=20 2.49.1