[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <146e59b4-76c-69e4-969-ce8a75ccfe5d@google.com>
Date: Tue, 9 Nov 2021 17:49:14 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Marco Elver <elver@...gle.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Vlastimil Babka <vbabka@...e.cz>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
kasan-dev@...glegroups.com, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] mm/slab_common: use WARN() if cache still has objects
on destroy
On Tue, 2 Nov 2021, Marco Elver wrote:
> Calling kmem_cache_destroy() while the cache still has objects allocated
> is a kernel bug, and will usually result in the entire cache being
> leaked. While the message in kmem_cache_destroy() resembles a warning,
> it is currently not implemented using a real WARN().
>
> This is problematic for infrastructure testing the kernel, all of which
> rely on the specific format of WARN()s to pick up on bugs.
>
> Some 13 years ago this used to be a simple WARN_ON() in slub, but
> d629d8195793 ("slub: improve kmem_cache_destroy() error message")
> changed it into an open-coded warning to avoid confusion with a bug in
> slub itself.
>
> Instead, turn the open-coded warning into a real WARN() with the message
> preserved, so that test systems can actually identify these issues, and
> we get all the other benefits of using a normal WARN(). The warning
> message is extended with "when called from <caller-ip>" to make it even
> clearer where the fault lies.
>
> For most configurations this is only a cosmetic change, however, note
> that WARN() here will now also respect panic_on_warn.
>
> Signed-off-by: Marco Elver <elver@...gle.com>
Acked-by: David Rientjes <rientjes@...gle.com>
Thanks Marco!
Powered by blists - more mailing lists