lkml.org 
[lkml]   [2019]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kmemleak: Do not corrupt the object_list during clean-up
On Fri, Oct 4, 2019 at 8:11 PM Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>
>
>
> On 04/10/2019 23:46, Catalin Marinas wrote:
> > In case of an error (e.g. memory pool too small), kmemleak disables
> > itself and cleans up the already allocated metadata objects. However, if
> > this happens early before the RCU callback mechanism is available,
> > put_object() skips call_rcu() and frees the object directly. This is not
> > safe with the RCU list traversal in __kmemleak_do_cleanup().
> >
> > Change the list traversal in __kmemleak_do_cleanup() to
> > list_for_each_entry_safe() and remove the rcu_read_{lock,unlock} since
> > the kmemleak is already disabled at this point. In addition, avoid an
> > unnecessary metadata object rb-tree look-up since it already has the
> > struct kmemleak_object pointer.
> >
> > Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations")
> > Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > Reported-by: Marc Dionne <marc.c.dionne@gmail.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
>
>
> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Tested-by: Song Liu <songliubraving@fb.com>

This fixes my vm, which could not boot with 5.4-rc3.

Thanks,
Song

\
 
 \ /
  Last update: 2019-10-09 18:37    [W:0.034 / U:31.976 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site