From nobody Sat May 18 10:08:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1650382076; cv=none; d=zohomail.com; s=zohoarc; b=E6oNuRjzZyEbsYAhnp9P74rrQzIMfC9wNWrnWsWIVC8D6o5/uW7hzVQb3NALALZaQYvVUXjC9V3iXSJTtay7xC54XhCUeYqKIjpgQQt9mFKrl6IdYPDIPUKzz8TXvNjWFvoCjjYXyGQhtteOXQZSkzM2UoZgGlYMUy7jw1MiQmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650382076; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=SRY6fFoEkwDepuYE3F+Azw1yfIVQHjL5Yry7Ql+M6Lg=; b=hOk4kvKAmYjLkLllbDSfoz+IXq29+ullvzqDG/ypWI4xfuhEZdaLq7HpwOUO7ujx3+Ggj8Huhf+X+uK4TjK+stY6kJLN4XjFRyb6Szt51uOxy35JKbWqVsHIkPPzko63GF7PHKtRxdtEKTSRVA/98vFBWwpsGK68btWQxiRTRcM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1650382075998960.8369703219153; Tue, 19 Apr 2022 08:27:55 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-198-6wKIIManOSi8BCCKU0k36g-1; Tue, 19 Apr 2022 11:27:51 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11BB91C05EC9; Tue, 19 Apr 2022 15:27:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8657640CFD01; Tue, 19 Apr 2022 15:27:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4A1201949761; Tue, 19 Apr 2022 15:27:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2B55A1947BBF for ; Tue, 19 Apr 2022 15:27:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 05F87C28124; Tue, 19 Apr 2022 15:27:47 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id A28B3C53533 for ; Tue, 19 Apr 2022 15:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650382074; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SRY6fFoEkwDepuYE3F+Azw1yfIVQHjL5Yry7Ql+M6Lg=; b=JUEhuT1s7U35MT6sD3THI9o+N/HVJnqRkS627Z7vMYIVmWMvhDS5xwhZMGRZAcDaTKo76w w6BheYc1s4YtJKL3mypV/dl72azo2tAFof88Ktuh/mL4PA5UwkIUDqUDKCTlYHMayiLlmg E3/f0C0qBusU6h3DAUJC9pH8/WBRQk4= X-MC-Unique: 6wKIIManOSi8BCCKU0k36g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] domain_cgroup: Fix a condition in virDomainCgroupConnectCgroup() Date: Tue, 19 Apr 2022 17:27:45 +0200 Message-Id: <15af9613d99088cd5b9e9872431997c7979201c6.1650382065.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1650382076641100002 Content-Type: text/plain; charset="utf-8"; x-default="true" While parts of QEMU's CGroup code were moved under hypervisor agnostic location (src/hypervisor/) a typo sneaked in. The inspiration for virDomainCgroupConnectCgroup() comes from qemuConnectCgroup(). The former is called upon reconnecting to a running domain (after daemon restart). While the latter returned early if the daemon was running unprivileged, the former returns early if the daemon runs privileged. This is obviously wrong, because root can set up CGroups. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2075765 Fixes: 788e2b58cb1896f1c25ebbdbde4bafddc5ed4dc9 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/hypervisor/domain_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c index 5af88155bc..8072465615 100644 --- a/src/hypervisor/domain_cgroup.c +++ b/src/hypervisor/domain_cgroup.c @@ -485,7 +485,7 @@ virDomainCgroupConnectCgroup(const char *prefix, bool privileged, char *machineName) { - if (privileged) + if (!privileged) return 0; =20 if (!virCgroupAvailable()) --=20 2.35.1