DPDK sanitizer seems cannot detect the overflow issue sometimes
Stephen Hemminger
stephen at networkplumber.org
Wed Jun 29 16:59:42 CEST 2022
On Wed, 29 Jun 2022 09:56:03 +0000
"halsey.pian at longsys.com" <halsey.pian at 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.
More information about the dev
mailing list