From: Baoquan He <bhe@redhat.com>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v2 12/12] mm/kasan: make kasan=on|off take effect for all three modes
Date: Thu, 14 Aug 2025 09:49:06 +0800 [thread overview]
Message-ID: <aJ1Akg7jMytAChgp@MiWiFi-R3L-srv> (raw)
In-Reply-To: <202508131826.n8gKkeXB-lkp@intel.com>
On 08/13/25 at 06:23pm, kernel test robot wrote:
> Hi Baoquan,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on powerpc/next]
> [also build test ERROR on powerpc/fixes jcmvbkbc-xtensa/xtensa-for-next linus/master v6.17-rc1]
> [cannot apply to akpm-mm/mm-everything next-20250813]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/mm-kasan-add-conditional-checks-in-functions-to-return-directly-if-kasan-is-disabled/20250812-205253
> base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
> patch link: https://lore.kernel.org/r/20250812124941.69508-13-bhe%40redhat.com
> patch subject: [PATCH v2 12/12] mm/kasan: make kasan=on|off take effect for all three modes
> config: um-randconfig-001-20250813 (https://download.01.org/0day-ci/archive/20250813/202508131826.n8gKkeXB-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250813/202508131826.n8gKkeXB-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202508131826.n8gKkeXB-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/static_key.h:1,
> from include/linux/alloc_tag.h:15,
> from include/linux/percpu.h:5,
> from include/linux/percpu_counter.h:14,
> from include/linux/mm_types.h:21,
> from include/linux/mmzone.h:22,
> from include/linux/gfp.h:7,
> from include/linux/umh.h:4,
> from include/linux/kmod.h:9,
> from include/linux/module.h:17,
> from arch/um/kernel/mem.c:7:
> arch/um/kernel/mem.c: In function 'arch_mm_preinit':
> >> arch/um/kernel/mem.c:65:31: error: 'kasan_flag_enabled' undeclared (first use in this function); did you mean 'kasan_hw_tags_enabled'?
> 65 | static_branch_enable(&kasan_flag_enabled);
> | ^~~~~~~~~~~~~~~~~~
Thanks for reporting this error. I reproduced it and fix it with below
change. While this change should be appended into patch 11.
It's because CONFIG_KASAN is unset, the static key kasan_flag_enabled
enabling is added in arch_mm_preinit() which is not in CONFIG_KASAN scope.
So here wrap it up within CONFIG_KASAN ifdeffery scope.
And also move the kasan_arg_disabled chekcing before kasan_flag_enabled
enabling because kasan_init() is called before main(). So in
kasan_init(), kernel parameter kasan=on|off hasn't been parsed.
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index d62f494e0808..2395ca33112a 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -26,9 +26,6 @@
int kasan_um_is_ready;
void kasan_init(void)
{
-
- if (kasan_arg_disabled)
- return;
/*
* kasan_map_memory will map all of the required address space and
* the host machine will allocate physical memory as necessary.
@@ -65,8 +62,12 @@ static unsigned long brk_end;
void __init arch_mm_preinit(void)
{
+
+#ifdef CONFIG_KASAN
/* Safe to call after jump_label_init(). Enables KASAN. */
- static_branch_enable(&kasan_flag_enabled);
+ if (!kasan_arg_disabled)
+ static_branch_enable(&kasan_flag_enabled);
+#endif
/* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE);
next prev parent reply other threads:[~2025-08-14 1:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 12:49 [PATCH v2 00/12] mm/kasan: make kasan=on|off work for all three modes Baoquan He
2025-08-12 12:49 ` [PATCH v2 01/12] mm/kasan: add conditional checks in functions to return directly if kasan is disabled Baoquan He
2025-08-12 12:49 ` [PATCH v2 02/12] mm/kasan: move kasan= code to common place Baoquan He
2025-08-12 12:49 ` [PATCH v2 03/12] mm/kasan/sw_tags: don't initialize kasan if it's disabled Baoquan He
2025-08-12 12:49 ` [PATCH v2 04/12] arch/arm: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 05/12] arch/arm64: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 06/12] arch/loongarch: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 07/12] arch/powerpc: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 08/12] arch/riscv: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 09/12] arch/x86: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 10/12] arch/xtensa: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 11/12] arch/um: " Baoquan He
2025-08-12 12:49 ` [PATCH v2 12/12] mm/kasan: make kasan=on|off take effect for all three modes Baoquan He
2025-08-13 10:23 ` kernel test robot
2025-08-14 1:49 ` Baoquan He [this message]
2025-08-12 13:39 ` [PATCH v2 00/12] mm/kasan: make kasan=on|off work " Baoquan He
2025-08-12 13:39 ` Baoquan He
2025-08-12 15:10 ` Baoquan He
2025-08-12 16:57 ` Andrey Konovalov
2025-08-12 17:14 ` Andrey Konovalov
2025-08-13 11:14 ` Baoquan He
2025-08-14 5:23 ` Andrey Konovalov
2025-08-14 8:56 ` Baoquan He
2025-08-16 4:50 ` Andrey Konovalov
2025-08-17 3:40 ` 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=aJ1Akg7jMytAChgp@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.