DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Maayan Kashani <mkashani@nvidia.com>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>, <stable@dpdk.org>,
	"Dariusz Sosnowski" <dsosnowski@nvidia.com>,
	Ori Kam <orika@nvidia.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	Gregory Etelson <getelson@nvidia.com>
Subject: Re: [PATCH] app/testpmd: fix mask in random flow item definition
Date: Fri, 1 Aug 2025 15:55:50 -0700	[thread overview]
Message-ID: <20250801155550.41558656@hermes.local> (raw)
In-Reply-To: <20250730113243.197386-1-mkashani@nvidia.com>

On Wed, 30 Jul 2025 14:32:43 +0300
Maayan Kashani <mkashani@nvidia.com> wrote:

> A previous patch addressing an ASAN global-buffer-overflow issue
> inadvertently degraded the random mask value translation.
> Specifically, changing the mask from 0xffff to 0x0000ffff caused
> the value to be shifted left by 16 bits, since Testpmd
> defines arg::mask as a byte array.
> 
> Independent of the ASAN fix, the random item mask specification
> was invalid at the API level: random items require a 32-bit mask,
> but only a 16-bit mask was being used.
> 
> The correct mask for this use case is 0xffffffff.
> This fix restores the correct random value translation
> by applying the proper 32-bit mask and
> addresses the original ASAN issue.
> 
> Fixes: 9a18070e3fe4 ("app/testpmd: fix flow random item token")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
> Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
> ---
>  app/test-pmd/cmdline_flow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 83d398f8eea..38e751f3f3c 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -5591,7 +5591,7 @@ static const struct token token_list[] = {
>  		.next = NEXT(item_random, NEXT_ENTRY(COMMON_UNSIGNED),
>  			     item_param),
>  		.args = ARGS(ARGS_ENTRY_MASK(struct rte_flow_item_random,
> -					     value, "\x00\x00\xff\xff")),
> +					     value, "\xff\xff\xff\xff")),
>  	},
>  	[ITEM_GRE_KEY] = {
>  		.name = "gre_key",

Applied to next-net


Using initialized strings as proxy for a byte array has lead to overflow
bugs and warnings on some compilers. Perhaps this might cause problems later.

      reply	other threads:[~2025-08-01 22:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 11:32 Maayan Kashani
2025-08-01 22:55 ` Stephen Hemminger [this message]

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=20250801155550.41558656@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=getelson@nvidia.com \
    --cc=mkashani@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    /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).