[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+fCnZcPXLZxCVAk2Cmhfvov9KNGxALQuWun_yKf0O+q=rbnfQ@mail.gmail.com>
Date: Thu, 1 Jul 2021 16:31:42 +0300
From: Andrey Konovalov <andreyknvl@...il.com>
To: Marco Elver <elver@...gle.com>, yee.lee@...iatek.com
Cc: wsd_upstream@...iatek.com,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Matthias Brugger <matthias.bgg@...il.com>,
"open list:KASAN" <kasan-dev@...glegroups.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@...ck.org>,
open list <linux-kernel@...r.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v3 1/1] kasan: Add memzero init for unaligned size under
SLUB debug
On Wed, Jun 30, 2021 at 10:13 PM Marco Elver <elver@...gle.com> wrote:
>
> > + if (IS_ENABLED(CONFIG_SLUB_DEBUG) && init && ((unsigned long)size & KASAN_GRANULE_MASK)) {
> > + init = false;
> > + memzero_explicit((void *)addr, size);
> > + }
> > size = round_up(size, KASAN_GRANULE_SIZE);
> >
> > hw_set_mem_tag_range((void *)addr, size, tag, init);
>
> I think this solution might be fine for now, as I don't see an easy way
> to do this without some major refactor to use kmem_cache_debug_flags().
>
> However, I think there's an intermediate solution where we only check
> the static-key 'slub_debug_enabled' though. Because I've checked, and
> various major distros _do_ enabled CONFIG_SLUB_DEBUG. But the static
> branch just makes sure there's no performance overhead.
>
> Checking the static branch requires including mm/slab.h into
> mm/kasan/kasan.h, which we currently don't do and perhaps wanted to
> avoid. Although I don't see a reason there, because there's no circular
> dependency even if we did.
Most likely this won't be a problem. We already include ../slab.h into
many mm/kasan/*.c files.
> Andrey, any opinion?
I like this approach. Easy to implement and is better than checking
only CONFIG_SLUB_DEBUG.
Thanks, Marco!
Powered by blists - more mailing lists