On Tue, Jun 17, 2025 at 7:07 PM Stephen Hemminger
<step...@networkplumber.org> wrote:
>
> On Tue, 17 Jun 2025 11:52:08 +0100
> Marat Khalili <marat.khal...@huawei.com> wrote:
>
> > This was flagged by undefined behaviour sanitizer: struct
> > rte_graph_cluster_stats is declared as `__rte_cache_aligned` but was
> > allocated using stdlib realloc which caused misaligned allocation. More
> > than one test needs to be executed in series in order to reproduce the
> > problem using graph_autotest, e.g:
> >
> >     app/dpdk-test --no-huge --no-pci -m128 graph_autotest graph_autotest
> >
> > First sanitizer message  (similar ones follow):
> >
> >     lib/graph/graph_stats.c:209:13: runtime error: member access within
> >     misaligned address 0x606000008ea0 for type 'struct
> >     rte_graph_cluster_stats', which requires 64 byte alignment
> >
> > To fix the issue replace realloc calls with rte_malloc and rte_realloc
> > specifying correct alignment, use rte_free to free the result.
> >
> > Signed-off-by: Marat Khalili <marat.khal...@huawei.com>
>
> There is a way to get aligned memory,
>
>        #include <stdlib.h>
>
>        int posix_memalign(void **memptr, size_t alignment, size_t size);
>        void *aligned_alloc(size_t alignment, size_t size);

There is a need for aligned realloc. I think it is not there in
standard libraries.



>

Reply via email to