From patchwork Sat Oct 2 16:24:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 100377 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F0361A0032; Sat, 2 Oct 2021 18:25:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4226441205; Sat, 2 Oct 2021 18:25:07 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id A6C854122D for ; Sat, 2 Oct 2021 18:25:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633191905; 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=LFF1BeAqQwlJJJ95Bm8Q8YGvb0zCTwNq+Qte80Wy9HE=; b=A6JaYG3Ai1SyGFT9FTP8Skv2+ip6YtC8qFO4S2/KlDS/tRFMewG8HkpprTQXO/kpzrclap p1W2I5JFA1n4HF3mZVGwrYPhsJMNo3XnQjXRkB/1o/DrTRaxirPHDOhWyq+rLytjfqnksc S3g2IUyewBCgNNcR9PgANF7d+/hZIw4= 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-584-Ev-6ZHwOMRudsGCX4ctT7Q-1; Sat, 02 Oct 2021 12:24:48 -0400 X-MC-Unique: Ev-6ZHwOMRudsGCX4ctT7Q-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 16911801FCE; Sat, 2 Oct 2021 16:24:47 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.194.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C6DB5C1D0; Sat, 2 Oct 2021 16:24:44 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: aconole@redhat.com, zhihongx.peng@intel.com, stable@dpdk.org, Stephen Hemminger , Long Li Date: Sat, 2 Oct 2021 18:24:30 +0200 Message-Id: <20211002162432.4348-2-david.marchand@redhat.com> In-Reply-To: <20211002162432.4348-1-david.marchand@redhat.com> References: <20210917082313.21934-1-david.marchand@redhat.com> <20211002162432.4348-1-david.marchand@redhat.com> 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=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 1/3] bus/vmbus: fix leak on device scan X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Caught running ASAN. The device name was leaked on scan. rte_device name field being a const, use a local pointer and release in error path. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: stable@dpdk.org Signed-off-by: David Marchand Acked-by: Long Li --- Changes since v1: - left rte_vmbus_device untouched, --- drivers/bus/vmbus/linux/vmbus_bus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c index 3c924eee14..68f6cc5742 100644 --- a/drivers/bus/vmbus/linux/vmbus_bus.c +++ b/drivers/bus/vmbus/linux/vmbus_bus.c @@ -236,13 +236,14 @@ vmbus_scan_one(const char *name) char filename[PATH_MAX]; char dirname[PATH_MAX]; unsigned long tmp; + char *dev_name; dev = calloc(1, sizeof(*dev)); if (dev == NULL) return -1; dev->device.bus = &rte_vmbus_bus.bus; - dev->device.name = strdup(name); + dev->device.name = dev_name = strdup(name); if (!dev->device.name) goto error; @@ -261,6 +262,7 @@ vmbus_scan_one(const char *name) /* skip non-network devices */ if (rte_uuid_compare(dev->class_id, vmbus_nic_uuid) != 0) { + free(dev_name); free(dev); return 0; } @@ -312,6 +314,7 @@ vmbus_scan_one(const char *name) } else { /* already registered */ VMBUS_LOG(NOTICE, "%s already registered", name); + free(dev_name); free(dev); } return 0; @@ -322,6 +325,7 @@ vmbus_scan_one(const char *name) error: VMBUS_LOG(DEBUG, "failed"); + free(dev_name); free(dev); return -1; } From patchwork Sat Oct 2 16:24:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 100375 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E96F5A0032; Sat, 2 Oct 2021 18:24:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF0C6411FE; Sat, 2 Oct 2021 18:24:56 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 7ABBC411A0 for ; Sat, 2 Oct 2021 18:24:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633191894; 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=MFH/u1/CHrquhCu22gaVAhIPRdqurtYPYxvQ1rXGr6w=; b=YcFKB+g4K+v6w63bIIaY4CkyHm+auFGF69vftcvyWhCOT7VSI65EEK5iKUuBEdsYMAes9S 8qrgs3gF+L1byqJduLYReSwfod27KNb+h95w2Sr5qUVTUGyvbVOuDMc4zkQ3hVcrEDeRlP 3eVgd00fdgf7Tu0qNGZrYCkas0WK87A= 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-47-EDKrR1X_PgaL4WEqc27-pA-1; Sat, 02 Oct 2021 12:24:53 -0400 X-MC-Unique: EDKrR1X_PgaL4WEqc27-pA-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 C30801927802; Sat, 2 Oct 2021 16:24:51 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.194.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99D235C1D0; Sat, 2 Oct 2021 16:24:49 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: aconole@redhat.com, zhihongx.peng@intel.com, stable@dpdk.org, Reshma Pattan , Naga Suresh Somarowthu Date: Sat, 2 Oct 2021 18:24:31 +0200 Message-Id: <20211002162432.4348-3-david.marchand@redhat.com> In-Reply-To: <20211002162432.4348-1-david.marchand@redhat.com> References: <20210917082313.21934-1-david.marchand@redhat.com> <20211002162432.4348-1-david.marchand@redhat.com> 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=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 2/3] test/latencystats: fix incorrect loop boundary X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Caught running ASAN. lat_stats_strings[] is an array containing NUM_STATS strings. Fixes: 1e3676a06e4c ("test/latency: add unit tests for latencystats library") Cc: stable@dpdk.org Signed-off-by: David Marchand Acked-by: Reshma Pattan --- app/test/test_latencystats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test/test_latencystats.c b/app/test/test_latencystats.c index 427339904d..724acbc315 100644 --- a/app/test/test_latencystats.c +++ b/app/test/test_latencystats.c @@ -80,7 +80,7 @@ static int test_latencystats_get_names(void) /* Success Test: Valid names and size */ size = NUM_STATS; ret = rte_latencystats_get_names(names, size); - for (i = 0; i <= NUM_STATS; i++) { + for (i = 0; i < NUM_STATS; i++) { if (strcmp(lat_stats_strings[i].name, names[i].name) == 0) printf(" %s\n", names[i].name); else From patchwork Sat Oct 2 16:24:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 100376 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22CBBA0032; Sat, 2 Oct 2021 18:25:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 147B9411F9; Sat, 2 Oct 2021 18:25:02 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id AEBE1411F0 for ; Sat, 2 Oct 2021 18:25:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633191900; 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=N93q44dDRnENYlp8e+XcI0WH5QfYtx/JQCMtlbTNuZ4=; b=bIuh0dGzHy8h7b0SLoku4nG3Lr1Nn/+KKkTlTSrovwCQaep5I9r08FTDooUsi1Q6og3+tw 1tYp6junGCzaJBp6E0q0wTlm16NCLc0lhDSQ0ILn7T1SgGOdScbGs8j2MSo/coPQdtLnu3 lELcwoFSS3HiWdgMfsIFGK34cfm7TMI= 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-51-gLqaZHNtMlai-WPofP6PSw-1; Sat, 02 Oct 2021 12:24:57 -0400 X-MC-Unique: gLqaZHNtMlai-WPofP6PSw-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 4858D8145FB; Sat, 2 Oct 2021 16:24:56 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.194.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39C9F5C3DF; Sat, 2 Oct 2021 16:24:53 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: aconole@redhat.com, zhihongx.peng@intel.com, Michael Santana Date: Sat, 2 Oct 2021 18:24:32 +0200 Message-Id: <20211002162432.4348-4-david.marchand@redhat.com> In-Reply-To: <20211002162432.4348-1-david.marchand@redhat.com> References: <20210917082313.21934-1-david.marchand@redhat.com> <20211002162432.4348-1-david.marchand@redhat.com> 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=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v2 3/3] ci: run unit tests with ASAN X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Enable ASAN for clang jobs. This can greatly help identify leaks and buffer overflows. This patch is more a fyi, as some unit tests stil have issues. Signed-off-by: David Marchand Acked-by: Aaron Conole --- .ci/linux-build.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index 91e43a975b..a961d9b92d 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -79,7 +79,14 @@ fi OPTS="$OPTS -Dmachine=default" OPTS="$OPTS --default-library=$DEF_LIB" -OPTS="$OPTS --buildtype=debugoptimized" + +if [ "$CC" != "${CC%%clang}" ] && [ "$RUN_TESTS" = 'true' ]; then + # Let's run tests with ASAN + OPTS="$OPTS -Db_sanitize=address -Db_lundef=false --buildtype=debug" +else + OPTS="$OPTS --buildtype=debugoptimized" +fi + OPTS="$OPTS -Dcheck_includes=true" meson build --werror $OPTS ninja -C build