From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B1D7EFD208 for ; Wed, 25 Feb 2026 08:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=I228xoUl4+ZrgdKCBvI2rCmcNIzmRojWxOXL2gQGmtk=; b=TSrC1t+kFgXmYxMbyzHs+dHVXi Z1UO60ydgkFfNa8Gee+CaNH3UOinip9BLYMMba4MxJCuGLEnWPuukahck1VqkfmOYIwbHWo/Qp2m7 Il2jKqpF9IU6l2H19VyKMVCxxxtB9I5qxd3pZi/u6cXPTAw4ioKzSb2gCjHqrUdu2t7orUssSAv0k 3MDBxxpbZfCoBebnKjZVRHeFAnpcAf1wbHFGMoX8b4cyvTqupy+3Zzu+PVOLftuA5ZEwVXLAenhkJ GhMquraJX1TtR2NtodhrKRi9E5nFWxvxCiEVml2OwHM7lcEvxngaRrobeebxkVtwaXsJZemDBrK64 aQTH6WnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vvA3k-00000003Ux9-1n8Y; Wed, 25 Feb 2026 08:15:52 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vvA3d-00000003UsO-2Ee3 for linux-um@lists.infradead.org; Wed, 25 Feb 2026 08:15:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772007344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I228xoUl4+ZrgdKCBvI2rCmcNIzmRojWxOXL2gQGmtk=; b=YFaxjKU3Aip3rfABQtb0SJkMq15lStiOS2C9v9rwcVcKs5QQBKI+Vg1q/au85DZh0U7My0 HD8TAw01aVTdevuwpNliB8KLAf0ro4mP387nhwzT9ITIlNQyniR9Lr5CgQQtYvTaNYzFPE MUAu1tJVVQRTLeMLxVuWXbAHu+jKhTY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-rwD-1e3zOqOiSldVPhFTdg-1; Wed, 25 Feb 2026 03:15:40 -0500 X-MC-Unique: rwD-1e3zOqOiSldVPhFTdg-1 X-Mimecast-MFC-AGG-ID: rwD-1e3zOqOiSldVPhFTdg_1772007338 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 01DB51956070; Wed, 25 Feb 2026 08:15:38 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.55]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 68EB31800286; Wed, 25 Feb 2026 08:15:29 +0000 (UTC) From: Baoquan He 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 Subject: [PATCH v5 06/15] arch/arm: don't initialize kasan if it's disabled Date: Wed, 25 Feb 2026 16:14:03 +0800 Message-ID: <20260225081412.76502-7-bhe@redhat.com> In-Reply-To: <20260225081412.76502-1-bhe@redhat.com> References: <20260225081412.76502-1-bhe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: X0ztNSziDGpTcrD4Sc2EvzNsnJge23lVUjbRDFcoTlE_1772007338 X-Mimecast-Originator: redhat.com Content-type: text/plain Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260225_001548_659687_A2213B37 X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org 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 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