[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c60897e7-fa5d-a1a9-09a6-c80cfe4b5fd5@suse.cz>
Date: Fri, 12 Aug 2022 12:28:53 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Imran Khan <imran.f.khan@...cle.com>, glider@...gle.com,
elver@...gle.com, dvyukov@...gle.com, cl@...ux.com,
penberg@...nel.org, rientjes@...gle.com, iamjoonsoo.kim@....com,
akpm@...ux-foundation.org, roman.gushchin@...ux.dev,
42.hyeyoo@...il.com
Cc: linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
linux-mm@...ck.org
Subject: Re: [PATCH v2] Introduce sysfs interface to disable kfence for
selected slabs.
On 8/11/22 10:59, Imran Khan wrote:
> By default kfence allocation can happen for any slab object, whose size
> is up to PAGE_SIZE, as long as that allocation is the first allocation
> after expiration of kfence sample interval. But in certain debugging
> scenarios we may be interested in debugging corruptions involving
> some specific slub objects like dentry or ext4_* etc. In such cases
> limiting kfence for allocations involving only specific slub objects
> will increase the probablity of catching the issue since kfence pool
> will not be consumed by other slab objects.
>
> This patch introduces a sysfs interface '/sys/kernel/slab/<name>/skip_kfence'
> to disable kfence for specific slabs. Having the interface work in this
> way does not impact current/default behavior of kfence and allows us to
> use kfence for specific slabs (when needed) as well. The decision to
> skip/use kfence is taken depending on whether kmem_cache.flags has
> (newly introduced) SLAB_SKIP_KFENCE flag set or not.
>
> Signed-off-by: Imran Khan <imran.f.khan@...cle.com>
Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
Nit below:
> ---
>
> Changes since v1:
> - Remove RFC tag
>
> include/linux/slab.h | 6 ++++++
> mm/kfence/core.c | 7 +++++++
> mm/slub.c | 27 +++++++++++++++++++++++++++
> 3 files changed, 40 insertions(+)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 0fefdf528e0d..947d912fd08c 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -119,6 +119,12 @@
> */
> #define SLAB_NO_USER_FLAGS ((slab_flags_t __force)0x10000000U)
>
> +#ifdef CONFIG_KFENCE
> +#define SLAB_SKIP_KFENCE ((slab_flags_t __force)0x20000000U)
> +#else
> +#define SLAB_SKIP_KFENCE 0
> +#endif
The whitespace here (spaces) differs from other flags above (tabs).
Powered by blists - more mailing lists