From: Andrey Ryabinin <ryabinin.a.a@gmail.com>
To: Marco Elver <elver@google.com>, Baoquan He <bhe@redhat.com>
Cc: linux-mm@kvack.org, glider@google.com, andreyknvl@gmail.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
Subject: Re: [PATCH 0/4] mm/kasan: make kasan=on|off work for all three modes
Date: Thu, 7 Aug 2025 19:12:02 +0200 [thread overview]
Message-ID: <c540359d-b609-425f-a921-c7dad3213811@gmail.com> (raw)
In-Reply-To: <CANpmjNP-29cuk+MY0w9rvLNizO02yY_ZxP+T0cmCZBi+b5tDTQ@mail.gmail.com>
On 8/6/25 9:16 AM, Marco Elver wrote:
> On Tue, 5 Aug 2025 at 08:23, 'Baoquan He' via kasan-dev
> <kasan-dev@googlegroups.com> wrote:
>>
>> Currently only hw_tags mode of kasan can be enabled or disabled with
>> kernel parameter kasan=on|off for built kernel. For kasan generic and
>> sw_tags mode, there's no way to disable them once kernel is built.
>> This is not convenient sometime, e.g in system kdump is configured.
>> When the 1st kernel has KASAN enabled and crash triggered to switch to
>> kdump kernel, the generic or sw_tags mode will cost much extra memory
>> for kasan shadow while in fact it's meaningless to have kasan in kdump
>> kernel.
>
> Are you using KASAN generic or SW-tags is production?
> If in a test environment, is the overhead of the kdump kernel really
> unacceptable?
>
kdump kernel operates with limited amount of memory, whatever was provided
in 'crashkernel=' for the primary kernel. So it's quite easily can ran out of memory.
By default kdump uses same as currently running kernel, but it can be configured
to use a different one.
At least in fedora it's in /etc/sysconfig/kdump:
$ cat /etc/sysconfig/kdump
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
# If no version is specified, then the init script will try to find a
# kdump kernel with the same version number as the running kernel.
KDUMP_KERNELVER=""
>> So this patchset moves the kasan=on|off out of hw_tags scope and into
>> common code to make it visible in generic and sw_tags mode too. Then we
>> can add kasan=off in kdump kernel to reduce the unneeded meomry cost for
>> kasan.
>>
>> Test:
>> =====
>> I only took test on x86_64 for generic mode, and on arm64 for
>> generic, sw_tags and hw_tags mode. All of them works well.
>
> Does it also work for CONFIG_KASAN_INLINE?
>
I think it should. Because we don't initialize init_task.kasan_depth we always
bail out in kasan_report().
next prev parent reply other threads:[~2025-08-07 17:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 6:23 Baoquan He
2025-08-05 6:23 ` [PATCH 1/4] mm/kasan: add conditional checks in functions to return directly if kasan is disabled Baoquan He
2025-08-05 6:23 ` [PATCH 2/4] mm/kasan: move kasan= code to common place Baoquan He
2025-08-06 7:11 ` Marco Elver
2025-08-08 13:01 ` Baoquan He
2025-08-05 6:23 ` [PATCH 3/4] mm/kasan: don't initialize kasan if it's disabled Baoquan He
2025-08-05 6:23 ` [PATCH 4/4] mm/kasan: make kasan=on|off take effect for all three modes Baoquan He
2025-08-06 5:22 ` SeongJae Park
2025-08-06 9:36 ` Baoquan He
2025-08-06 16:26 ` Lorenzo Stoakes
2025-08-08 13:08 ` Baoquan He
2025-08-08 13:24 ` Lorenzo Stoakes
2025-08-12 13:27 ` Baoquan He
2025-08-12 17:06 ` Lorenzo Stoakes
2025-08-06 18:24 ` Sabyrzhan Tasbolatov
2025-08-08 15:59 ` Baoquan He
2025-08-06 7:16 ` [PATCH 0/4] mm/kasan: make kasan=on|off work " Marco Elver
2025-08-07 17:12 ` Andrey Ryabinin [this message]
2025-08-08 3:21 ` Baoquan He
2025-08-07 16:34 ` Andrey Ryabinin
2025-08-08 12:54 ` 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=c540359d-b609-425f-a921-c7dad3213811@gmail.com \
--to=ryabinin.a.a@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=bhe@redhat.com \
--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=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