All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "halsey.pian@longsys.com" <halsey.pian@longsys.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: DPDK sanitizer seems cannot detect the overflow issue sometimes
Date: Wed, 29 Jun 2022 07:59:42 -0700	[thread overview]
Message-ID: <20220629075942.57ee94b0@hermes.local> (raw)
In-Reply-To: <95F5C09B652250489A8640C2D0DF5BD0BF99503E@lsex.goodwill-ic.com>

On Wed, 29 Jun 2022 09:56:03 +0000
"halsey.pian@longsys.com" <halsey.pian@longsys.com> wrote:

> Dear All,
> 
> I would try to detect the illegal memory access issues in my App based on DPDK, so I add some codes based on several overflow scenario to check if it is detected in DPDK standalone project.
> 
> It seems that DPDK santizer cannot find the overflow issue below,
> 
> I add some code into examples/helloworld/main.c as below,
> 
> char*p = (char*)rte_zmalloc(NULL, 9, 4096);
> 
> if(p != NULL)
> {
> 	p = p + 32;
> 	*p = 'A‘  // should be overflow here
> }
> 
> But there is no any sanitzer output after dpdk-helloworld exit.
> 
> BTW, DPDK sanitzer can detect the overflow below,
> 
> 
> char*p = (char*)rte_zmalloc(NULL, 9, 4096);
> 
> if(p != NULL)
> {
> 	p[9] = 'A‘  // can be detected
> }
> 
> Unfortunately, DPDK cannot detect the overflow when update the code to below,
> 	p[32] = 'A' // cannot be detected
> 
> 
> Version: DPDK 21.11.1
> OS: Fedora 32
> Build: meson setup -Dbuildtype=debug -Db_lundef=false -Db_sanitize=address -Dexamples=hellowowrld build
> 
> Is it a known issue? I am confused with this. 
> Could you provide some info? Thanks.
> 
> Best Regards
> Halsey Pian

Sorry, it won't work.

There is some integration with Google Address Sanitizer (ASAN) but it does not
change the underlying algorithm of how memory is allocated with rte_malloc().

The way ASAN works for regular malloc is that it adds guard regions for each
allocation. That would be very difficult to do with DPDK rte_malloc() which
uses huge pages.

You are better off just using regular malloc in your application unless you
need to use hugepages.

      reply	other threads:[~2022-06-29 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  9:56 DPDK sanitizer seems cannot detect the overflow issue sometimes halsey.pian
2022-06-29 14:59 ` 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=20220629075942.57ee94b0@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=halsey.pian@longsys.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.