<div dir="ltr"><br><br>Dmitry Kozlyuk <<a href="mailto:dmitry.kozliuk@gmail.com">dmitry.kozliuk@gmail.com</a>> 于2023年10月23日周一 04:22写道:<br>><br>> 2023-09-22 16:12 (UTC+0800), Fengnan Chang:<br>> > ping<br>> ><br>> > Fengnan Chang <<a href="mailto:changfengnan@bytedance.com">changfengnan@bytedance.com</a>> 于2023年9月12日周二 17:05写道:<br>> > ><br>> > > Let's look at this path:<br>> > > malloc_elem_free<br>> > >    ->malloc_elem_join_adjacent_free<br>> > >       ->join_elem(elem, elem->next)<br>> > ><br>> > > 0. cur elem's pad > 0<br>> > > 1. data area memset in malloc_elem_free first.<br>> > > 2. next elem is free, try to join cur elem and next.<br>> > > 3. in join_elem, try to modify inner->size, this address had<br>> > > memset in step 1, it casue the content of addrees become non-zero.<br>> > ><br>> > > If user call rte_zmalloc, and pick this elem, it can't get all<br>> > > zero'd memory.<br>><br>> malloc_elem_join_adjacent_free() always calls memset() after join_elem(),<br>> for the next and the previous element respectively.<br>when try to call join_elem() for the next element in malloc_elem_join_adjacent_free(),<br>the memset is try to memset <b>next</b> element, but join_elem() is update <b>current</b> element's<div>content, which shoudn't happen, it's two different element.</div><div><br>> How to reproduce this bug?</div><div>when I test this patch,</div><div><a href="https://patches.dpdk.org/project/dpdk/patch/20230831111937.60975-1-changfengnan@bytedance.com/">https://patches.dpdk.org/project/dpdk/patch/20230831111937.60975-1-changfengnan@bytedance.com/</a><br></div><div>I have a case try to alloc 64/128/192 size object and free with 16 threads, after every</div><div>alloc I'll check wheather all content is 0 or not.</div><div>It's not easy to reproduce, you can have a try, it's easier to find</div><div>this problem in code level.</div></div>