From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Baoquan He <bhe@redhat.com>,
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
Subject: Re: [PATCH v5 09/15] arch/powerpc: don't initialize kasan if it's disabled
Date: Tue, 17 Mar 2026 08:09:41 +0530 [thread overview]
Message-ID: <161b024f-9022-45c6-9808-815b8ea83bd9@linux.ibm.com> (raw)
In-Reply-To: <0bc30137-3f1d-4a4a-8573-8f26866fcc26@kernel.org>
On 12/03/26 16:53, Christophe Leroy (CS GROUP) wrote:
>
>
> Le 12/03/2026 à 12:12, Sourabh Jain a écrit :
>>
>>
>> On 25/02/26 13:44, Baoquan He wrote:
>>> Here, kasan is disabled if specified 'kasan=off' in kernel cmdline.
>>>
>>> This includes 32bit, book3s/64 and book3e/64.
>>>
>>> Signed-off-by: Baoquan He <bhe@redhat.com>
>>> Cc: linuxppc-dev@lists.ozlabs.org
>>> ---
>>> arch/powerpc/mm/kasan/init_32.c | 6 +++++-
>>> arch/powerpc/mm/kasan/init_book3e_64.c | 4 ++++
>>> arch/powerpc/mm/kasan/init_book3s_64.c | 4 ++++
>>> 3 files changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/mm/kasan/init_32.c
>>> b/arch/powerpc/mm/kasan/ init_32.c
>>> index 1d083597464f..0ea2a636c992 100644
>>> --- a/arch/powerpc/mm/kasan/init_32.c
>>> +++ b/arch/powerpc/mm/kasan/init_32.c
>>> @@ -141,6 +141,10 @@ void __init kasan_init(void)
>>> u64 i;
>>> int ret;
>>> + /* If KASAN is disabled via command line, don't initialize it. */
>>> + if (kasan_arg_disabled)
>>> + return;
>>> +
>>> for_each_mem_range(i, &base, &end) {
>>> phys_addr_t top = min(end, total_lowmem);
>>> @@ -170,7 +174,7 @@ void __init kasan_init(void)
>>> void __init kasan_late_init(void)
>>> {
>>> - if (IS_ENABLED(CONFIG_KASAN_VMALLOC))
>>> + if (IS_ENABLED(CONFIG_KASAN_VMALLOC) && kasan_enabled())
>>> kasan_unmap_early_shadow_vmalloc();
>>> }
>>> diff --git a/arch/powerpc/mm/kasan/init_book3e_64.c
>>> b/arch/powerpc/mm/ kasan/init_book3e_64.c
>>> index 0d3a73d6d4b0..fbe4c9a7e460 100644
>>> --- a/arch/powerpc/mm/kasan/init_book3e_64.c
>>> +++ b/arch/powerpc/mm/kasan/init_book3e_64.c
>>> @@ -111,6 +111,10 @@ void __init kasan_init(void)
>>> u64 i;
>>> pte_t zero_pte = pfn_pte(virt_to_pfn(kasan_early_shadow_page),
>>> PAGE_KERNEL_RO);
>>> + /* If KASAN is disabled via command line, don't initialize it. */
>>> + if (kasan_arg_disabled)
>>> + return;
>>> +
>>> for_each_mem_range(i, &start, &end)
>>> kasan_init_phys_region(phys_to_virt(start),
>>> phys_to_virt(end));
>>> diff --git a/arch/powerpc/mm/kasan/init_book3s_64.c
>>> b/arch/powerpc/mm/ kasan/init_book3s_64.c
>>> index dcafa641804c..f7906f9ef9be 100644
>>> --- a/arch/powerpc/mm/kasan/init_book3s_64.c
>>> +++ b/arch/powerpc/mm/kasan/init_book3s_64.c
>>> @@ -54,6 +54,10 @@ void __init kasan_init(void)
>>> u64 i;
>>> pte_t zero_pte = pfn_pte(virt_to_pfn(kasan_early_shadow_page),
>>> PAGE_KERNEL);
>>> + /* If KASAN is disabled via command line, don't initialize it. */
>>> + if (kasan_arg_disabled)
>>> + return;
>>> +
>>> if (!early_radix_enabled()) {
>>> pr_warn("KASAN not enabled as it requires radix!");
>>> return;
>>
>> Should we log in the kernel log buffer that KASAN is disabled?
>>
>> Right now, I don't see the kernel advertising the same.
>
> When KASAN is enabled it is advertised with:
>
> pr_info("KernelAddressSanitizer initialized (generic)\n");
>
> Isn't the absence of that message enough to understand KASAN is not
> there ?
Yes this should work. Thanks.
- Sourabh Jain
>
>>
>> $ dmesg | grep -i kasan
>> [ 0.000000] Kernel command line: BOOT_IMAGE=(ieee1275//vdevice/v-
>> scsi@30000070/disk@8100000000000000,msdos2)/vmlinuz-7.0.0-rc3+
>> crashkernel=2G kasan=off
>>
>> Tested this series on powerpc Pseries platform.
>> So feel free to add:
>> Tested-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>
>> - Sourabh Jain
>>
>
next prev parent reply other threads:[~2026-03-17 2:40 UTC|newest]
Thread overview: 23+ 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 ` [PATCH v5 06/15] arch/arm: " Baoquan He
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-03-12 11:12 ` Sourabh Jain
2026-03-12 11:23 ` Christophe Leroy (CS GROUP)
2026-03-17 2:10 ` Baoquan He
2026-03-17 2:39 ` Sourabh Jain [this message]
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-03-12 12:53 ` Samuel Holland
2026-03-17 3:36 ` Baoquan He
2026-03-17 3:49 ` Samuel Holland
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=161b024f-9022-45c6-9808-815b8ea83bd9@linux.ibm.com \
--to=sourabhjain@linux.ibm.com \
--cc=andreyknvl@gmail.com \
--cc=bhe@redhat.com \
--cc=chleroy@kernel.org \
--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