On Wed, May 4, 2022 at 4:32 PM Anatoly Burakov
<[email protected]> 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: [email protected]
>
Reported-by: David Marchand <[email protected]>
> Signed-off-by: Anatoly Burakov <[email protected]>
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