Re: [PATCH v5 1/2] mm, kasan: improve double-free detection

From: Andrey Ryabinin
Date: Thu Jun 09 2016 - 12:59:51 EST


On 06/07/2016 09:03 PM, Kuthonuzo Luruo wrote:

Next time, when/if you send patch series, send patches in one thread, i.e. patches should be replies to the cover letter.
Your patches are not linked together, which makes them harder to track.


> Currently, KASAN may fail to detect concurrent deallocations of the same
> object due to a race in kasan_slab_free(). This patch makes double-free
> detection more reliable by serializing access to KASAN object metadata.
> New functions kasan_meta_lock() and kasan_meta_unlock() are provided to
> lock/unlock per-object metadata. Double-free errors are now reported via
> kasan_report().
>
> Per-object lock concept from suggestion/observations by Dmitry Vyukov.
>


So, I still don't like this, this too way hacky and complex.
I have some thoughts about how to make this lockless and robust enough.
I'll try to sort this out tomorrow.