From nobody Thu Sep 19 01:11:09 2024 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718370511436262.5500979205676; Fri, 14 Jun 2024 06:08:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 538D811A9; Fri, 14 Jun 2024 09:08:30 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8B8811123; Fri, 14 Jun 2024 09:07:20 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8FBA01238; Fri, 14 Jun 2024 09:07:16 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 753A21209 for ; Fri, 14 Jun 2024 09:07:11 -0400 (EDT) Received: from mx-prod-mc-01.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-263-_wgiWMjSNEO0oQeblxbavw-1; Fri, 14 Jun 2024 09:07:09 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FD3A195608E for ; Fri, 14 Jun 2024 13:07:08 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6015319560AA for ; Fri, 14 Jun 2024 13:07:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: *** X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718370431; 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=4+n8icvYvLvqIbiykazdohBFjJlVG9b9EVR8zkFm5dk=; b=fjinShe5GHOAkY8cGF9Inrmr2uP3i01xaf6j4vd6O29EJ5hAUuTPqDiamEe5OdBZy1JPBT eUZMwiBGvK2fcfTECnS8zQwFUJByox96jmBViPf7jxoxYjRFBNZdFZ64FKyS+XcW7bREKV rInJeY8X6GUMtw2tJjUWgKWHy1BvSE0= X-MC-Unique: _wgiWMjSNEO0oQeblxbavw-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 3/3] remote_daemon_dispatch: Unref sasl session when closing client connection Date: Fri, 14 Jun 2024 15:07:01 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5SW64HDRV4HTOXNJYXX26EQWGXJPNITC X-Message-ID-Hash: 5SW64HDRV4HTOXNJYXX26EQWGXJPNITC X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718370512449100001 Content-Type: text/plain; charset="utf-8"; x-default="true" In ideal world, where clients close connection gracefully their SASL session is freed in virNetServerClientDispose() as it's stored in client->sasl. Unfortunately, if client connection is closed prematurely (e.g. the moment virsh asks for credentials), the _virNetServerClient member is never set and corresponding SASL session is never freed. The handler is still stored in client private data, so free it in remoteClientCloseFunc(). 20,862 (288 direct, 20,574 indirect) bytes in 3 blocks are definitely los= t in loss record 1,763 of 1,772 at 0x50390C4: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.= 0.7800.6) by 0x501BDAF: g_object_new_internal.part.0 (in /usr/lib64/libgobject-2= .0.so.0.7800.6) by 0x501D43D: g_object_new_with_properties (in /usr/lib64/libgobject-2= .0.so.0.7800.6) by 0x501E318: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7800.6) by 0x49BAA63: virObjectNew (virobject.c:252) by 0x49BABC6: virObjectLockableNew (virobject.c:274) by 0x4B0526C: virNetSASLSessionNewServer (virnetsaslcontext.c:230) by 0x18EEFC: remoteDispatchAuthSaslInit (remote_daemon_dispatch.c:3696) by 0x15E128: remoteDispatchAuthSaslInitHelper (remote_daemon_dispatch_= stubs.h:74) by 0x4B0FA5E: virNetServerProgramDispatchCall (virnetserverprogram.c:4= 23) by 0x4B0F591: virNetServerProgramDispatch (virnetserverprogram.c:299) by 0x4B18AE3: virNetServerProcessMsg (virnetserver.c:135) Signed-off-by: Michal Privoznik --- src/remote/remote_daemon_dispatch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index cfc1067e40..c88c9f5b15 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1776,6 +1776,10 @@ static void remoteClientCloseFunc(virNetServerClient= *client) daemonRemoveAllClientStreams(priv->streams); =20 remoteClientFreePrivateCallbacks(priv); + +#if WITH_SASL + virObjectUnref(priv->sasl); +#endif } =20 =20 --=20 2.44.2