From patchwork Wed Nov 25 15:00:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1406107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I7R/xZfU; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ch3wv73x4z9s0b for ; Thu, 26 Nov 2020 02:00:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 77EF087196; Wed, 25 Nov 2020 15:00:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oIRK-mhcUiZw; Wed, 25 Nov 2020 15:00:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 623A78263C; Wed, 25 Nov 2020 15:00:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 50828C0891; Wed, 25 Nov 2020 15:00:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44EA7C0891 for ; Wed, 25 Nov 2020 15:00:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3290A87183 for ; Wed, 25 Nov 2020 15:00:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Alw1fMYOPzq for ; Wed, 25 Nov 2020 15:00:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by whitealder.osuosl.org (Postfix) with ESMTPS id CC535870B1 for ; Wed, 25 Nov 2020 15:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606316441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TQ3w31DtdYk7ElJIovh/t5joBgBmVRa+YZZw6WxfqUA=; b=I7R/xZfU1i9P7//+D/M9oExer8NaAv9E33qAj3gDyxmb7jrsYnV8M74kduiq0PFf7MlcvC mI/bwBcI6oikzQqQZnsMusgzWZkbkPUEumb7aOtsJi+vKBnTnDURJ5CMwCRXH8RpOGTEgf 66GTynFyhb5Y7ZuroG3l3XOl8/wk+DE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-BgRcQ-ewNoqn4-pdvxLHcw-1; Wed, 25 Nov 2020 10:00:39 -0500 X-MC-Unique: BgRcQ-ewNoqn4-pdvxLHcw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 393A41006C94; Wed, 25 Nov 2020 15:00:38 +0000 (UTC) Received: from dceara.remote.csb (ovpn-114-80.ams2.redhat.com [10.36.114.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 585D15C1A3; Wed, 25 Nov 2020 15:00:37 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Wed, 25 Nov 2020 16:00:34 +0100 Message-Id: <20201125150030.22532.14780.stgit@dceara.remote.csb> In-Reply-To: <20201125150014.22532.14956.stgit@dceara.remote.csb> References: <20201125150014.22532.14956.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH ovn 1/2] ovn-controller-vtep: Fix leak of multicast macs. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Also, enable valgrind runs for ovn-controller-vtep when running "make check-valgrind". Fixes: dd6218709a00 ("ovn-controller-vtep: Support BUM traffic for the VTEP Schema.") Suggested-by: Ilya Maximets Signed-off-by: Dumitru Ceara --- Note: This is a brute force approach of just tracking all pointers in a hmapx and unifying cleanup. There might be a better approach but I couldn't figure it out. --- controller-vtep/vtep.c | 10 +++++++--- tests/automake.mk | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/controller-vtep/vtep.c b/controller-vtep/vtep.c index 5538c7d..f3b02f6 100644 --- a/controller-vtep/vtep.c +++ b/controller-vtep/vtep.c @@ -18,6 +18,7 @@ #include "vtep.h" #include "lib/hash.h" +#include "lib/hmapx.h" #include "openvswitch/hmap.h" #include "openvswitch/shash.h" #include "lib/ovn-util.h" @@ -496,12 +497,12 @@ vtep_run(struct controller_vtep_ctx *ctx) struct shash physical_locators = SHASH_INITIALIZER(&physical_locators); struct shash vtep_pbs = SHASH_INITIALIZER(&vtep_pbs); struct shash non_vtep_pbs = SHASH_INITIALIZER(&non_vtep_pbs); + struct hmapx mcast_macs_ptrs = HMAPX_INITIALIZER(&mcast_macs_ptrs); const struct vteprec_physical_switch *vtep_ps; const struct vteprec_logical_switch *vtep_ls; const struct vteprec_ucast_macs_remote *umr; const struct sbrec_port_binding *port_binding_rec; const struct vteprec_mcast_macs_remote *mmr; - struct shash_node *node; /* Collects 'Physical_Switch's. */ VTEPREC_PHYSICAL_SWITCH_FOR_EACH (vtep_ps, ctx->vtep_idl) { @@ -527,7 +528,8 @@ vtep_run(struct controller_vtep_ctx *ctx) /* Collects 'Mcast_Macs_Remote's. */ VTEPREC_MCAST_MACS_REMOTE_FOR_EACH (mmr, ctx->vtep_idl) { - struct mmr_hash_node_data *mmr_ext = xmalloc(sizeof *mmr_ext);; + struct mmr_hash_node_data *mmr_ext = xmalloc(sizeof *mmr_ext); + hmapx_add(&mcast_macs_ptrs, mmr_ext); char *mac_tnlkey = xasprintf("%s_%"PRId64, mmr->MAC, mmr->logical_switch && mmr->logical_switch->n_tunnel_key @@ -575,11 +577,13 @@ vtep_run(struct controller_vtep_ctx *ctx) sset_destroy(&vtep_pswitches); shash_destroy(&vtep_lswitches); shash_destroy(&ucast_macs_rmts); - SHASH_FOR_EACH (node, &mcast_macs_rmts) { + struct hmapx_node *node; + HMAPX_FOR_EACH (node, &mcast_macs_ptrs) { struct mmr_hash_node_data *mmr_ext = node->data; shash_destroy(&mmr_ext->physical_locators); free(mmr_ext); } + hmapx_destroy(&mcast_macs_ptrs); shash_destroy(&mcast_macs_rmts); shash_destroy(&physical_locators); shash_destroy(&vtep_pbs); diff --git a/tests/automake.mk b/tests/automake.mk index 44be209..0ee58af 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -101,6 +101,7 @@ check-lcov: all $(check_DATA) clean-lcov valgrind_wrappers = \ tests/valgrind/ovn-controller \ + tests/valgrind/ovn-controller-vtep \ tests/valgrind/ovn-nbctl \ tests/valgrind/ovn-northd \ tests/valgrind/ovn-sbctl \ From patchwork Wed Nov 25 15:00:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1406108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cUlh/TWc; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ch3xY44nGz9s0b for ; Thu, 26 Nov 2020 02:01:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5B4802E17F; Wed, 25 Nov 2020 15:01:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AOwJHWWayxri; Wed, 25 Nov 2020 15:01:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 7BA1C2E17B; Wed, 25 Nov 2020 15:00:57 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 51458C0052; Wed, 25 Nov 2020 15:00:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1811AC0052 for ; Wed, 25 Nov 2020 15:00:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 07B0387144 for ; Wed, 25 Nov 2020 15:00:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pyHOnh3T1TSA for ; Wed, 25 Nov 2020 15:00:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by whitealder.osuosl.org (Postfix) with ESMTPS id 820CD87174 for ; Wed, 25 Nov 2020 15:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606316453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G5vCuTYiSNnxhwM3IEmSMvdpRqvU+L+buAeKPPO5/SE=; b=cUlh/TWc90MuvAi00wc9AvJniSz2Jj7kVburh+44fsBs1eaortID/iYFG/TSxvir77GVCj zfCTZftZdO93imveyqN77/EJWZtSNtaUaH3ehG8UzOcbeDhe4QQmy/7jI2z0TiF1mglL6y QyPqSRCVvoW43QpttVkSaxwbkxVK7SY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-467-F1qArbqnOvm0yZg7QCA6rg-1; Wed, 25 Nov 2020 10:00:51 -0500 X-MC-Unique: F1qArbqnOvm0yZg7QCA6rg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20A5310151E7; Wed, 25 Nov 2020 15:00:50 +0000 (UTC) Received: from dceara.remote.csb (ovpn-114-80.ams2.redhat.com [10.36.114.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4378A19D6C; Wed, 25 Nov 2020 15:00:49 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Wed, 25 Nov 2020 16:00:46 +0100 Message-Id: <20201125150043.22532.87498.stgit@dceara.remote.csb> In-Reply-To: <20201125150014.22532.14956.stgit@dceara.remote.csb> References: <20201125150014.22532.14956.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH ovn 2/2] tests: Enable memory leak checking when running with AddressSanitizer. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Recent commits cleaned up most of the minor leaks that would've made tests with AddressSanitizer memory leak checking enabled fail. It should be safe (and useful) to check for memory leaks by default. Signed-off-by: Dumitru Ceara --- tests/atlocal.in | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 4517ebf..d9a4c91 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -205,8 +205,5 @@ export OVS_CTL_TIMEOUT # Add some default flags to make the tests run better under Address # Sanitizer, if it was used for the build. -# -# We disable leak detection because otherwise minor leaks that don't -# matter break everything. -ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=asan:$ASAN_OPTIONS +ASAN_OPTIONS=detect_leaks=1:abort_on_error=true:log_path=asan:$ASAN_OPTIONS export ASAN_OPTIONS