On Wed, May 4, 2022 at 4:32 PM Anatoly Burakov <anatoly.bura...@intel.com> wrote: > > Currently, when we free previously allocated memory, we mark the area as > "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a > malloc element will cause pages to be unmapped from memory and re-backed > with anonymous memory again. This may cause ASan's "use-after-free" > error down the line, because the allocator will try to write into > memory areas recently marked as "freed". > > To fix this, we need to mark the unmapped memory area as "available", > and fixup surrounding malloc element header/trailers to enable later > malloc routines to safely write into new malloc elements' headers or > trailers.
Bugzilla ID: 994 > Fixes: 6cc51b1293ce ("mem: instrument allocator for ASan") > Cc: sta...@dpdk.org > Reported-by: David Marchand <david.march...@redhat.com> > Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com> It fixes the issues I saw with unit tests. Applied, thanks for working on this problem. I'll respin my series that enables ASan in GHA. -- David marchand