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 7656BA0093 for ; Wed, 9 Mar 2022 17:32:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71130410DC; Wed, 9 Mar 2022 17:32:07 +0100 (CET) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mails.dpdk.org (Postfix) with ESMTP id 2C4B7410E1 for ; Wed, 9 Mar 2022 17:32:06 +0100 (CET) Received: by mail-wm1-f53.google.com with SMTP id 19so1690535wmy.3 for ; Wed, 09 Mar 2022 08:32:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mw8LXdvSL7/Gd2KzDATqLL/fI+4H57/xk20sB5BlQnc=; b=Moa/b0p7QfBxlP2LbDIRD2Owq6q/eeX/KXwyne8kPhRY1xp5THoTzYB5viYbgAQXLn m81hzdNUdba8wNsEEf5TKFiQjieAXMp5AfrePx8Dz0zaHLGucaArPnhrdX780+L/vvkq BGtdUFjLSosVvku+NoTQb3k1Q+EDi+NAjJx6T+2GDfS0Alj6Z1XcN5tRzVuj7VvIlb5u FwKUSenngEPoUgJZKY0SS6GjPJjxg1Jlc7fXLls2aWGN3hNnBjRfEZ1Zx4apPaegKeo8 A8qm00vVoo1vNrYFc+/7CY7o4+AIhiMky4vxcwLUJKU7cCnznxp8TIQUerTyBIonnOZA SOLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Mw8LXdvSL7/Gd2KzDATqLL/fI+4H57/xk20sB5BlQnc=; b=RoaKZO6Pj7gd6qQPylGR5tLfNOsQ4jsJlmi/Y/9snVG5AECY6JC/5muhwN0CJLXCkJ zmqNxnZ8WFaIwh00NcKV15thCJNhjSu4woeDXRI6JHxqGItM8lZPOx1EkTovnaZSdlkF Z2aPcJ5SCzJD4eV96fYXEXWX5taQwRcXKe38zya0svBOtFGrD9PrOdbj4txoh0P3G6cN tRjDrOu9p27jmt5ffPHN/6NWgEn/e6nFzsfdZfKLU0a0oiBy/pTXNJBx1B5+2A4HOSjp SJLFs6EY+S9AJVjTdrMdJKCh19VfpYg+iEvhAHFLw4K7n/XATBISwegXy2PQgcqQbu++ Q/Xg== X-Gm-Message-State: AOAM530tPA2RUjx9turhjZPGC2Q2i1zf9Vh301MQ56xYKr9x1m5IJJc0 ESgTRbsv7sfMp7plCjY9AG3+F3P5HnA= X-Google-Smtp-Source: ABdhPJxZKLcK/aGreEvEsHcKrbgFar4MeQqsBC9uFJabUfImSzLoovNQqFN1hwmg+JR/fHQhS9/0BQ== X-Received: by 2002:a05:600c:27cb:b0:381:400d:3bba with SMTP id l11-20020a05600c27cb00b00381400d3bbamr8344659wmb.60.1646843525786; Wed, 09 Mar 2022 08:32:05 -0800 (PST) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id r1-20020a5d4941000000b001ed89dcacbbsm2033171wrs.23.2022.03.09.08.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 08:32:05 -0800 (PST) From: luca.boccassi@gmail.com To: Reshma Pattan Cc: Stephen Hemminger , dpdk stable Subject: patch 'app/pdump: abort on multi-core capture limit' has been queued to stable release 20.11.5 Date: Wed, 9 Mar 2022 16:30:38 +0000 Message-Id: <20220309163053.245754-22-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220309163053.245754-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> <20220309163053.245754-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 20.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/11/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/30d6d025329463056262ecd9095ebbe67113bdd4 Thanks. Luca Boccassi --- >From 30d6d025329463056262ecd9095ebbe67113bdd4 Mon Sep 17 00:00:00 2001 From: Reshma Pattan Date: Mon, 28 Feb 2022 09:58:56 +0000 Subject: [PATCH] app/pdump: abort on multi-core capture limit [ upstream commit 3ee04ebc91f3872c4c1d9f9911f0cdfa32377d8c ] Check lcore id value is not the maximum core supported. Using lcore id without this check might cause out of bound access inside the rte_eal_wait_lcore. Coverity issue: 375841 Fixes: b2854d5317e8 ("app/pdump: support multi-core capture") Signed-off-by: Reshma Pattan Acked-by: Stephen Hemminger --- app/pdump/main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index b34bf33531..36b14fa59f 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -906,11 +906,21 @@ dump_packets_core(void *arg) return 0; } +static unsigned int +get_next_core(unsigned int lcore) +{ + lcore = rte_get_next_lcore(lcore, 1, 0); + if (lcore == RTE_MAX_LCORE) + rte_exit(EXIT_FAILURE, + "Max core limit %u reached for packet capture", lcore); + return lcore; +} + static inline void dump_packets(void) { int i; - uint32_t lcore_id = 0; + unsigned int lcore_id = 0; if (!multiple_core_capture) { printf(" core (%u), capture for (%d) tuples\n", @@ -936,12 +946,12 @@ dump_packets(void) return; } - lcore_id = rte_get_next_lcore(lcore_id, 1, 0); + lcore_id = get_next_core(lcore_id); for (i = 0; i < num_tuples; i++) { rte_eal_remote_launch(dump_packets_core, &pdump_t[i], lcore_id); - lcore_id = rte_get_next_lcore(lcore_id, 1, 0); + lcore_id = get_next_core(lcore_id); if (rte_eal_wait_lcore(lcore_id) < 0) rte_exit(EXIT_FAILURE, "failed to wait\n"); -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-09 16:30:09.344937714 +0000 +++ 0022-app-pdump-abort-on-multi-core-capture-limit.patch 2022-03-09 16:30:08.551025243 +0000 @@ -1 +1 @@ -From 3ee04ebc91f3872c4c1d9f9911f0cdfa32377d8c Mon Sep 17 00:00:00 2001 +From 30d6d025329463056262ecd9095ebbe67113bdd4 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 3ee04ebc91f3872c4c1d9f9911f0cdfa32377d8c ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 04a38e8911..96fa76f8da 100644 +index b34bf33531..36b14fa59f 100644 @@ -24 +25 @@ -@@ -900,11 +900,21 @@ dump_packets_core(void *arg) +@@ -906,11 +906,21 @@ dump_packets_core(void *arg) @@ -47 +48 @@ -@@ -930,12 +940,12 @@ dump_packets(void) +@@ -936,12 +946,12 @@ dump_packets(void)