From: "Mcnamara, John" <john.mcnamara@intel.com>
To: "Pattan, Reshma" <reshma.pattan@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"thomas@monjalon.net" <thomas@monjalon.net>
Cc: "stephen@networkplumber.org" <stephen@networkplumber.org>,
"Yigit, Ferruh" <ferruh.yigit@intel.com>,
"Pattan, Reshma" <reshma.pattan@intel.com>,
"vipin.varghese@intel.com" <vipin.varghese@intel.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH v4] app/pdump: check lcore is not the maximum core
Date: Tue, 8 Mar 2022 13:47:45 +0000 [thread overview]
Message-ID: <DM6PR11MB322742A881D7179BC0158312FC099@DM6PR11MB3227.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220228095856.58563-1-reshma.pattan@intel.com>
Thomas, could you include this in RC3 if possible.
> -----Original Message-----
> From: Reshma Pattan <reshma.pattan@intel.com>
> Sent: Monday, February 28, 2022 9:59 AM
> To: dev@dpdk.org
> Cc: stephen@networkplumber.org; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Pattan, Reshma <reshma.pattan@intel.com>; vipin.varghese@intel.com;
> stable@dpdk.org
> Subject: [PATCH v4] app/pdump: check lcore is not the maximum core
>
> 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")
> Cc: vipin.varghese@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
> v4: Remove inline of new function
> Change lcore type as unsigned int
> return lcore from the function
> ---
> 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
> 04a38e8911..96fa76f8da 100644
> --- a/app/pdump/main.c
> +++ b/app/pdump/main.c
> @@ -900,11 +900,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", @@ -930,12
> +940,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.25.1
next prev parent reply other threads:[~2022-03-08 13:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 15:18 [PATCH] " Reshma Pattan
2022-02-18 16:27 ` Stephen Hemminger
2022-02-21 10:19 ` [PATCH v2] " Reshma Pattan
2022-02-22 11:02 ` [PATCH v3] " Reshma Pattan
2022-02-25 9:59 ` Pattan, Reshma
2022-02-25 17:34 ` Stephen Hemminger
2022-02-28 9:58 ` [PATCH v4] " Reshma Pattan
2022-02-28 17:09 ` Stephen Hemminger
2022-03-08 13:47 ` Mcnamara, John [this message]
2022-03-08 14:27 ` Thomas Monjalon
2022-03-08 15:03 ` Mcnamara, John
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB322742A881D7179BC0158312FC099@DM6PR11MB3227.namprd11.prod.outlook.com \
--to=john.mcnamara@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=vipin.varghese@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).