linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: kasan-dev@googlegroups.com
Cc: linux-mm@kvack.org, andreyknvl@gmail.com, ryabinin.a.a@gmail.com,
	glider@google.com, dvyukov@google.com,
	linux-kernel@vger.kernel.org, linux-um@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev,
	linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
	x86@kernel.org, chris@zankel.net, jcmvbkbc@gmail.com,
	linux-s390@vger.kernel.org, hca@linux.ibm.com,
	Baoquan He <bhe@redhat.com>
Subject: [PATCH v5 06/15] arch/arm: don't initialize kasan if it's disabled
Date: Wed, 25 Feb 2026 16:14:03 +0800	[thread overview]
Message-ID: <20260225081412.76502-7-bhe@redhat.com> (raw)
In-Reply-To: <20260225081412.76502-1-bhe@redhat.com>

Here, kasan is disabled if specified 'kasan=off' in kernel cmdline.

And also call jump_label_init() early in setup_arch() so that later
kasan_init() can enable static key kasan_flag_enabled. Put
jump_label_init() beofre parse_early_param() as other architectures
do.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/kernel/setup.c  | 6 ++++++
 arch/arm/mm/kasan_init.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 0bfd66c7ada0..453a47a4c715 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1135,6 +1135,12 @@ void __init setup_arch(char **cmdline_p)
 	early_fixmap_init();
 	early_ioremap_init();
 
+	/*
+	 * Initialise the static keys early as they may be enabled by the
+	 * kasan_init() or early parameters.
+	 */
+	jump_label_init();
+
 	parse_early_param();
 
 #ifdef CONFIG_MMU
diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c
index c6625e808bf8..82ec043c891f 100644
--- a/arch/arm/mm/kasan_init.c
+++ b/arch/arm/mm/kasan_init.c
@@ -212,6 +212,9 @@ void __init kasan_init(void)
 	phys_addr_t pa_start, pa_end;
 	u64 i;
 
+	/* If KASAN is disabled via command line, don't initialize it. */
+	if (kasan_arg_disabled)
+		return;
 	/*
 	 * We are going to perform proper setup of shadow memory.
 	 *
-- 
2.52.0



  parent reply	other threads:[~2026-02-25  8:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25  8:13 [PATCH v5 00/15] mm/kasan: make kasan=on|off work for all three modes Baoquan He
2026-02-25  8:13 ` [PATCH v5 01/15] mm/kasan: add conditional checks in functions to return directly if kasan is disabled Baoquan He
2026-02-25  8:13 ` [PATCH v5 02/15] mm/kasan: rename 'kasan_arg' to 'kasan_arg_disabled' Baoquan He
2026-02-25  8:14 ` [PATCH v5 03/15] mm/kasan: mm/kasan: move kasan= code to common place Baoquan He
2026-02-25  8:14 ` [PATCH v5 04/15] mm/kasan: make kasan=on|off take effect for all three modes Baoquan He
2026-02-25  8:14 ` [PATCH v5 05/15] mm/kasan/sw_tags: don't initialize kasan if it's disabled Baoquan He
2026-02-25  8:14 ` Baoquan He [this message]
2026-02-25  8:14 ` [PATCH v5 07/15] arch/arm64: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 08/15] arch/loongarch: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 09/15] arch/powerpc: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 10/15] arch/riscv: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 11/15] arch/x86: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 12/15] arch/xtensa: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 13/15] arch/um: " Baoquan He
2026-02-25  8:14 ` [PATCH v5 14/15] mm/kasan: add document into kernel-parameters.txt Baoquan He
2026-02-25  8:14 ` [PATCH v5 15/15] mm/kasan: clean up unneeded ARCH_DEFER_KASAN and kasan_arch_is_ready Baoquan He

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=20260225081412.76502-7-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=andreyknvl@gmail.com \
    --cc=chris@zankel.net \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=hca@linux.ibm.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=ryabinin.a.a@gmail.com \
    --cc=x86@kernel.org \
    /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