Re: [PATCH 1/2] mm: vmalloc: implement vrealloc()

From: Christoph Hellwig
Date: Tue Jul 23 2024 - 09:45:14 EST


On Tue, Jul 23, 2024 at 01:28:32PM +0200, Uladzislau Rezki wrote:
> Concurrent vfree() will lead to use-after-free. Either add a comment
> that a user is responsible for not using vrealloc()/vfree() on the same
> pointer concurrently or use find_unlink_vmap_area() which might be more
> complex when it comes to design of the vrealloc().

You can never use *free concurrently with *realloc. I guess it doesn't
hurt to clearly document that, but other than that we should not try
to cater to that use pattern at all.