DPDK patches and discussions
 help / color / mirror / Atom feed
* DPDK sanitizer seems cannot detect the overflow issue sometimes
@ 2022-06-29  9:56 halsey.pian
  2022-06-29 14:59 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: halsey.pian @ 2022-06-29  9:56 UTC (permalink / raw)
  To: dev; +Cc: halsey.pian

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: DPDK sanitizer seems cannot detect the overflow issue sometimes
  2022-06-29  9:56 DPDK sanitizer seems cannot detect the overflow issue sometimes halsey.pian
@ 2022-06-29 14:59 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2022-06-29 14:59 UTC (permalink / raw)
  To: halsey.pian; +Cc: dev

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-29 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29  9:56 DPDK sanitizer seems cannot detect the overflow issue sometimes halsey.pian
2022-06-29 14:59 ` Stephen Hemminger

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).