diff mbox series

kasan: depend on CONFIG_SLUB_DEBUG

Message ID 20180622154623.25388-1-Jason@zx2c4.com
State New
Headers show
Series kasan: depend on CONFIG_SLUB_DEBUG | expand

Commit Message

Jason A. Donenfeld June 22, 2018, 3:46 p.m. UTC
KASAN depends on having access to some of the accounting that SLUB_DEBUG
does; without it, there are immediate crashes [1]. So, the natural thing
to do is to make KASAN select SLUB_DEBUG.

[1] http://lkml.kernel.org/r/CAHmME9rtoPwxUSnktxzKso14iuVCWT7BE_-_8PAC=pGw1iJnQg@mail.gmail.com

Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()")
Cc: Shakeel Butt <shakeelb@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
Cc: <linux-mm@kvack.org>
Cc: <linux-kernel@vger.kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

---
 lib/Kconfig.kasan | 1 +
 1 file changed, 1 insertion(+)

-- 
2.17.1

Comments

Michal Hocko June 22, 2018, 3:58 p.m. UTC | #1
On Fri 22-06-18 17:46:23, Jason A. Donenfeld wrote:
> KASAN depends on having access to some of the accounting that SLUB_DEBUG

> does; without it, there are immediate crashes [1]. So, the natural thing

> to do is to make KASAN select SLUB_DEBUG.

> 

> [1] http://lkml.kernel.org/r/CAHmME9rtoPwxUSnktxzKso14iuVCWT7BE_-_8PAC=pGw1iJnQg@mail.gmail.com

> 

> Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()")

> Cc: Shakeel Butt <shakeelb@google.com>

> Cc: David Rientjes <rientjes@google.com>

> Cc: Christoph Lameter <cl@linux.com>

> Cc: Pekka Enberg <penberg@kernel.org>

> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>

> Cc: Andrew Morton <akpm@linux-foundation.org>

> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>

> Cc: <stable@vger.kernel.org>

> Cc: <linux-mm@kvack.org>

> Cc: <linux-kernel@vger.kernel.org>

> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>


This is the simplest way to do but I strongly suspect that the whole
SLUB_DEBUG is not really necessary

Acked-by: Michal Hocko <mhocko@suse.com>


> ---

>  lib/Kconfig.kasan | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan

> index 3d35d062970d..c253c1b46c6b 100644

> --- a/lib/Kconfig.kasan

> +++ b/lib/Kconfig.kasan

> @@ -6,6 +6,7 @@ if HAVE_ARCH_KASAN

>  config KASAN

>  	bool "KASan: runtime memory debugger"

>  	depends on SLUB || (SLAB && !DEBUG_SLAB)

> +	select SLUB_DEBUG if SLUB

>  	select CONSTRUCTORS

>  	select STACKDEPOT

>  	help

> -- 

> 2.17.1


-- 
Michal Hocko
SUSE Labs
Shakeel Butt June 22, 2018, 4:10 p.m. UTC | #2
On Fri, Jun 22, 2018 at 8:46 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>

> KASAN depends on having access to some of the accounting that SLUB_DEBUG

> does; without it, there are immediate crashes [1]. So, the natural thing

> to do is to make KASAN select SLUB_DEBUG.

>

> [1] http://lkml.kernel.org/r/CAHmME9rtoPwxUSnktxzKso14iuVCWT7BE_-_8PAC=pGw1iJnQg@mail.gmail.com

>

> Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()")

> Cc: Shakeel Butt <shakeelb@google.com>

> Cc: David Rientjes <rientjes@google.com>

> Cc: Christoph Lameter <cl@linux.com>

> Cc: Pekka Enberg <penberg@kernel.org>

> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>

> Cc: Andrew Morton <akpm@linux-foundation.org>

> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>

> Cc: <stable@vger.kernel.org>

> Cc: <linux-mm@kvack.org>

> Cc: <linux-kernel@vger.kernel.org>

> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>


Reviewed-by: Shakeel Butt <shakeelb@google.com>


> ---

>  lib/Kconfig.kasan | 1 +

>  1 file changed, 1 insertion(+)

>

> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan

> index 3d35d062970d..c253c1b46c6b 100644

> --- a/lib/Kconfig.kasan

> +++ b/lib/Kconfig.kasan

> @@ -6,6 +6,7 @@ if HAVE_ARCH_KASAN

>  config KASAN

>         bool "KASan: runtime memory debugger"

>         depends on SLUB || (SLAB && !DEBUG_SLAB)

> +       select SLUB_DEBUG if SLUB

>         select CONSTRUCTORS

>         select STACKDEPOT

>         help

> --

> 2.17.1

>
diff mbox series

Patch

diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 3d35d062970d..c253c1b46c6b 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -6,6 +6,7 @@  if HAVE_ARCH_KASAN
 config KASAN
 	bool "KASan: runtime memory debugger"
 	depends on SLUB || (SLAB && !DEBUG_SLAB)
+	select SLUB_DEBUG if SLUB
 	select CONSTRUCTORS
 	select STACKDEPOT
 	help