[PATCH v2 1/1] malloc: fix ASan handling for unmapped memory

David Marchand david.marchand at redhat.com
Thu May 5 11:10:42 CEST 2022


On Wed, May 4, 2022 at 4:32 PM Anatoly Burakov
<anatoly.burakov at 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: stable at dpdk.org
>

Reported-by: David Marchand <david.marchand at redhat.com>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at 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



More information about the stable mailing list