From nobody Sun Feb 8 23:05:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1662639936; cv=none; d=zohomail.com; s=zohoarc; b=PgD1MiZkO+uPEbNfFO5ANaNmxMlLKNyttqgSsJzgz9151shaWi7be+xqJ/ugYhRlZe1B5fYp5hGtbQv6TIJ3ziuXbBZpCdS2MbtB2eSAo7BcjoIZKXcs9d4oIr2hiQgAIxwnC5oe4FzrpY+k+r0sYQFKpA5/Z9NRvuLPaxwwCzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662639936; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ogm0iHgWxRfoOF8kvYPyud+fKbgE1OP5qbC+cEfxW0o=; b=YHrG0mQkz6B9YigLrl8q0itVCr01rHU8Xqau2S/PbnzV05HOk3J+NJNAFZ5TYcFbF0CgiSlo6z9Za69A3jbLsHfP/tt9cKgpLn9/XL5zlzGQf+9jW+Xp9MvledUVYKviisQWDtvdgBVS/pWoBYsbmzJ53JuqlT2mT+YPMIjJHKo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1662639936616873.890409928153; Thu, 8 Sep 2022 05:25:36 -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-255-fds6RMx7OdmVAFny_k1VnA-1; Thu, 08 Sep 2022 08:25:34 -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 A2E013804534; Thu, 8 Sep 2022 12:25:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DB5A403A9DD; Thu, 8 Sep 2022 12:25:11 +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 834721946A49; Thu, 8 Sep 2022 12:25:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9B0051946A53 for ; Thu, 8 Sep 2022 12:25:10 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7CD1D2166B2C; Thu, 8 Sep 2022 12:25:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3F882166B31 for ; Thu, 8 Sep 2022 12:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662639935; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ogm0iHgWxRfoOF8kvYPyud+fKbgE1OP5qbC+cEfxW0o=; b=DU6je4uw+7AJwIFZHaiFNb6vZ7PAP2CCJoi4q1JvjEnNZsCjrRMBU9adPNUxmS2Xr1bYth NZbrA6nmFB+Y6qlnp2mRP4QhYno/zbbHGX6ktVdDm9CBOj+7LtZSS73lqMq3cBQxpHjCVY O6aHiwfTr9aFCGCfGxqZdMORUwY9mVY= X-MC-Unique: fds6RMx7OdmVAFny_k1VnA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/5] remote: dispatch: Allocate 'virDomainDef' in ACL helpers dynamically Date: Thu, 8 Sep 2022 14:25:03 +0200 Message-Id: <8ca4893a137cd25b9d5a3ba7117c376233ee1545.1662639767.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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 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: 1662639938657100002 Content-Type: text/plain; charset="utf-8" At time of this patch struct 'virDomainDef' has 1736 bytes. Allocate it dynamically to keep the stack frame size in reasonable values. This patch also fixes remoteRelayDomainQemuMonitorEventCheckACL, where we didn't clear the stack'd variable prior to use. Fortunately for now the code didn't look at anything else than what the code overwrote. Signed-off-by: Peter Krempa --- src/remote/remote_daemon_dispatch.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index dc5790f077..4f42cdc610 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -154,22 +154,21 @@ static bool remoteRelayDomainEventCheckACL(virNetServerClient *client, virConnectPtr conn, virDomainPtr dom) { - virDomainDef def; + g_autofree virDomainDef *def =3D g_new0(virDomainDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; /* For now, we just create a virDomainDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - memset(&def, 0, sizeof(def)); - def.name =3D dom->name; - memcpy(def.uuid, dom->uuid, VIR_UUID_BUFLEN); + def->name =3D dom->name; + memcpy(def->uuid, dom->uuid, VIR_UUID_BUFLEN); if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectDomainEventRegisterAnyCheckACL(conn, &def); + ret =3D virConnectDomainEventRegisterAnyCheckACL(conn, def); cleanup: ignore_value(virIdentitySetCurrent(NULL)); @@ -284,21 +283,21 @@ static bool remoteRelayDomainQemuMonitorEventCheckACL(virNetServerClient *client, virConnectPtr conn, virDomainPtr= dom) { - virDomainDef def; + g_autofree virDomainDef *def =3D g_new0(virDomainDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; /* For now, we just create a virDomainDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - def.name =3D dom->name; - memcpy(def.uuid, dom->uuid, VIR_UUID_BUFLEN); + def->name =3D dom->name; + memcpy(def->uuid, dom->uuid, VIR_UUID_BUFLEN); if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectDomainQemuMonitorEventRegisterCheckACL(conn, &def); + ret =3D virConnectDomainQemuMonitorEventRegisterCheckACL(conn, def); cleanup: ignore_value(virIdentitySetCurrent(NULL)); --=20 2.37.1