From: Andrey Konovalov <andreyknvl@gmail.com>
To: Baoquan He <bhe@redhat.com>
Cc: linux-mm@kvack.org, ryabinin.a.a@gmail.com, glider@google.com,
dvyukov@google.com, vincenzo.frascino@arm.com,
akpm@linux-foundation.org, kasan-dev@googlegroups.com,
linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
elver@google.com, sj@kernel.org, lorenzo.stoakes@oracle.com,
snovitoll@gmail.com, christophe.leroy@csgroup.eu
Subject: Re: [PATCH v4 01/12] mm/kasan: add conditional checks in functions to return directly if kasan is disabled
Date: Fri, 5 Dec 2025 16:07:10 +0100 [thread overview]
Message-ID: <CA+fCnZdZQFVBf_NkrKk0U+TAptfi6RRmCkPY5ZpOUeObBpwAnQ@mail.gmail.com> (raw)
In-Reply-To: <aTKHzmxR3JA2R7qD@fedora>
On Fri, Dec 5, 2025 at 8:21 AM Baoquan He <bhe@redhat.com> wrote:
>
> On 12/04/25 at 05:38pm, Andrey Konovalov wrote:
> > On Fri, Nov 28, 2025 at 4:33 AM Baoquan He <bhe@redhat.com> wrote:
> > >
> > > The current codes only check if kasan is disabled for hw_tags
> > > mode. Here add the conditional checks for functional functions of
> > > generic mode and sw_tags mode.
> > >
> > > This is prepared for later adding kernel parameter kasan=on|off for
> > > all three kasan modes.
> > >
> > > Signed-off-by: Baoquan He <bhe@redhat.com>
> > > ---
> > > mm/kasan/generic.c | 17 +++++++++++++++--
> > > mm/kasan/init.c | 6 ++++++
> > > mm/kasan/quarantine.c | 3 +++
> > > mm/kasan/report.c | 4 +++-
> > > mm/kasan/shadow.c | 11 ++++++++++-
> > > mm/kasan/sw_tags.c | 3 +++
> > > 6 files changed, 40 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> > > index 2b8e73f5f6a7..aff822aa2bd6 100644
> > > --- a/mm/kasan/generic.c
> > > +++ b/mm/kasan/generic.c
> > > @@ -214,12 +214,13 @@ bool kasan_byte_accessible(const void *addr)
> > >
> > > void kasan_cache_shrink(struct kmem_cache *cache)
> > > {
> > > - kasan_quarantine_remove_cache(cache);
> > > + if (kasan_enabled())
> >
> > Please move these checks to include/linux/kasan.h and add __helpers to
> > consistent with how it's done for other KASAN annotation calls.
> > Otherwise eventually these checks start creeping into lower level
> > functions and the logic of checking when and whether KASAN is enabled
> > becomes a mess.
>
> Not sure if I got it correctly. Are you suggesting it should be done
> like kasan_populate_vmalloc()/__kasan_populate_vmalloc(),
> kasan_release_vmalloc()/__kasan_release_vmalloc()?
Yes, please (assuming you're referring to how these functions are
defined with all Sabyrzhan's patches applied).
next prev parent reply other threads:[~2025-12-05 15:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 3:33 [PATCH v4 00/12] mm/kasan: make kasan=on|off work for all three modes Baoquan He
2025-11-28 3:33 ` [PATCH v4 01/12] mm/kasan: add conditional checks in functions to return directly if kasan is disabled Baoquan He
2025-12-04 16:38 ` Andrey Konovalov
2025-12-05 7:20 ` Baoquan He
2025-12-05 15:07 ` Andrey Konovalov [this message]
2025-11-28 3:33 ` [PATCH v4 02/12] mm/kasan: move kasan= code to common place Baoquan He
2025-12-04 16:39 ` Andrey Konovalov
2025-11-28 3:33 ` [PATCH v4 03/12] mm/kasan/sw_tags: don't initialize kasan if it's disabled Baoquan He
2025-12-04 16:40 ` Andrey Konovalov
2025-11-28 3:33 ` [PATCH v4 04/12] arch/arm: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 05/12] arch/arm64: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 06/12] arch/loongarch: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 07/12] arch/powerpc: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 08/12] arch/riscv: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 09/12] arch/x86: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 10/12] arch/xtensa: " Baoquan He
2025-11-28 3:33 ` [PATCH v4 11/12] arch/um: " Baoquan He
2025-12-01 10:56 ` Johannes Berg
2025-12-02 13:13 ` Baoquan He
2025-11-28 3:33 ` [PATCH v4 12/12] mm/kasan: make kasan=on|off take effect for all three modes Baoquan He
2025-11-28 15:50 ` Alexander Potapenko
2025-11-30 2:49 ` Baoquan He
2025-12-04 16:40 ` Andrey Konovalov
2025-12-04 16:38 ` [PATCH v4 00/12] mm/kasan: make kasan=on|off work " Andrey Konovalov
2025-12-05 7:14 ` Baoquan He
2025-12-05 11:03 ` Heiko Carstens
2025-12-05 12:57 ` Baoquan He
2025-12-05 15:07 ` Andrey Konovalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+fCnZdZQFVBf_NkrKk0U+TAptfi6RRmCkPY5ZpOUeObBpwAnQ@mail.gmail.com \
--to=andreyknvl@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=ryabinin.a.a@gmail.com \
--cc=sj@kernel.org \
--cc=snovitoll@gmail.com \
--cc=vincenzo.frascino@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox