From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5EE2CA0032 for ; Fri, 24 Jun 2022 17:02:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A920400EF; Fri, 24 Jun 2022 17:02:08 +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 2D79B400EF for ; Fri, 24 Jun 2022 17:02:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656082924; 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; bh=1E3aoG2aGYCvVrqWNd9fw83SCOwbrS8oTeXFloA8r4g=; b=XG8N9we2ANflUWsxSykXsj65eBtNdDRVBf63YI6BfGFqejGO9NaLk4X97Wz0Nk9YkeFHe6 gOA125HJCHYNMDR7Svl2X0ake06oW9ZeFzwF7C+CLkC4jslCjlnYg7bz/2/PEz3ix9MUQd 6EAuRLZhJvNDpRieJOtFy+Bmw9fQyIs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-nEYDYOxtNgqwpjskPG5GvA-1; Fri, 24 Jun 2022 11:02:01 -0400 X-MC-Unique: nEYDYOxtNgqwpjskPG5GvA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 224BD101E988; Fri, 24 Jun 2022 15:02:01 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.194.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id E265F18EAB; Fri, 24 Jun 2022 15:01:59 +0000 (UTC) From: Kevin Traynor To: Chengwen Feng Cc: David Marchand , Jerin Jacob , dpdk stable Subject: patch 'trace: fix init with long file prefix' has been queued to stable release 21.11.2 Date: Fri, 24 Jun 2022 16:01:09 +0100 Message-Id: <20220624150148.1855580-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/27/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/b55b2820d215b4a24cb402aeb4bdf2f4ab6f0870 Thanks. Kevin --- >From b55b2820d215b4a24cb402aeb4bdf2f4ab6f0870 Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Fri, 17 Jun 2022 10:29:11 +0800 Subject: [PATCH] trace: fix init with long file prefix [ upstream commit d59a940667989461e2916207e7fbb8148504c44f ] Bug scenario: 1. start testpmd: $ dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* \ --file-prefix=trace_autotest -- -i 2. then observed: EAL: eal_trace_init():93 failed to initialize trace [File exists] EAL: FATAL: Cannot init trace EAL: Cannot init trace EAL: Error - exiting with code: 1 The root cause it that the offset set wrong with long file-prefix and then lead the strftime return failed. At the same time, trace_session_name_generate() uses errno as the return value, but the errno was not set if strftime returned zero. A previously set errno (EEXIST or ENOENT from call to mkdir for creating the runtime configuration directory) was returned in this case. This is fragile and may lead to incorrect logic if errno was set to 0 previously. This also resulted in inaccurate prompting. Set errno to ENOSPC if strftime return zero. Fixes: 321dd5f8fa62 ("trace: add internal init and fini interface") Signed-off-by: Chengwen Feng Reviewed-by: David Marchand Acked-by: Jerin Jacob --- lib/eal/common/eal_common_trace_utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c index 64f58fb66a..2b55dbec65 100644 --- a/lib/eal/common/eal_common_trace_utils.c +++ b/lib/eal/common/eal_common_trace_utils.c @@ -105,11 +105,13 @@ trace_session_name_generate(char *trace_dir) TRACE_PREFIX_LEN); if (rc == -E2BIG) - rc = TRACE_PREFIX_LEN; + rc = TRACE_PREFIX_LEN - 1; trace_dir[rc++] = '-'; rc = strftime(trace_dir + rc, TRACE_DIR_STR_LEN - rc, "%Y-%m-%d-%p-%I-%M-%S", tm_result); - if (rc == 0) + if (rc == 0) { + errno = ENOSPC; goto fail; + } return rc; -- 2.34.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-24 15:51:08.953407065 +0100 +++ 0001-trace-fix-init-with-long-file-prefix.patch 2022-06-24 15:51:08.764983794 +0100 @@ -1 +1 @@ -From d59a940667989461e2916207e7fbb8148504c44f Mon Sep 17 00:00:00 2001 +From b55b2820d215b4a24cb402aeb4bdf2f4ab6f0870 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit d59a940667989461e2916207e7fbb8148504c44f ] + @@ -29 +30,0 @@ -Cc: stable@dpdk.org