Skip to contentSkip to conversation

mm/kasan/init.c:282:20: error: redefinition of 'kasan_populate_early_vm_area_shadow'

PATCH In review Naresh Kamboju 3 participants 6 messages Oct 11, 2021 – Oct 12, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Regression found on x86_64 gcc-11 built with KASAN enabled. Following build warnings / errors reported on linux next 20211011.

metadata:

    git_describe: next-20211011
    git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
    git_short_log: d3134eb5de85 (\"Add linux-next specific files for 20211011\")
    target_arch: x86_64
    toolchain: gcc-11

build error :
--------------
mm/kasan/init.c:282:20: error: redefinition of 'kasan_populate_early_vm_area_shadow'
282 | void __init __weak kasan_populate_early_vm_area_shadow(void *start,

      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:34,
                 from include/linux/memblock.h:13,
                 from mm/kasan/init.c:9:

include/linux/kasan.h:463:20: note: previous definition of 'kasan_populate_early_vm_area_shadow' with type 'void(void *, long unsigned int)'
463 | static inline void kasan_populate_early_vm_area_shadow(void *start,

      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:288: mm/kasan/init.o] Error 1 make[3]: Target '__build' not remade because of errors.

build link:
-----------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/build.log

build config:
-------------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

# To install tuxmake on your system globally

# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-11
--kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config
Signature · 2 lines
Linaro LKFT
https://lkft.linaro.org
#1 lore raw

PATCH 1/1 mm: kasan: Fix redefinition of 'kasan_populate_early_vm_area_shadow'

Move kasan_populate_early_vm_area_shadow() from mm/kasan/init.c to mm/kasan/shadow.c, make it under CONFIG_KASAN_VMALLOC to fix the redefinition issue.

---
Hi Andrew,
Could you help to merge this into previos patch
"kasan: arm64: fix pcpu_page_first_chunk crash with KASAN_VMALLOC",
sorry for the build error.

 mm/kasan/init.c   | 5 -----
 mm/kasan/shadow.c | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
mm/kasan/init.c +0 -5
index d39577d088a1..cc64ed6858c6 100644
@@ -279,11 +279,6 @@ int __ref kasan_populate_early_shadow(const void *shadow_start,
 	return 0;
 }
 
-void __init __weak kasan_populate_early_vm_area_shadow(void *start,
-						       unsigned long size)
-{
-}
-
 static void kasan_free_pte(pte_t *pte_start, pmd_t *pmd)
 {
 	pte_t *pte;
mm/kasan/shadow.c +5 -0
index 8d95ee52d019..4a4929b29a23 100644
@@ -254,6 +254,11 @@ core_initcall(kasan_memhotplug_init);
 
 #ifdef CONFIG_KASAN_VMALLOC
 
+void __init __weak kasan_populate_early_vm_area_shadow(void *start,
+						       unsigned long size)
+{
+}
+
 static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr,
 				      void *unused)
 {
Signature · 1 line
2.27.0
#2 lore raw

Re: [PATCH] mm: kasan: Fix redefinition of 'kasan_populate_early_vm_area_shadow'

Quoted 10 lines · Kefeng Wang

Move kasan_populate_early_vm_area_shadow() from mm/kasan/init.c to mm/kasan/shadow.c, make it under CONFIG_KASAN_VMALLOC to fix the redefinition issue.

Quoted 5 lines

---
Hi Andrew,
Could you help to merge this into previos patch
"kasan: arm64: fix pcpu_page_first_chunk crash with KASAN_VMALLOC",
sorry for the build error.

Correct Andrew's mail.

Quoted 38 lines
  mm/kasan/init.c   | 5 -----
  mm/kasan/shadow.c | 5 +++++
  2 files changed, 5 insertions(+), 5 deletions(-)
mm/kasan/init.c +0 -5
index d39577d088a1..cc64ed6858c6 100644
@@ -279,11 +279,6 @@ int __ref kasan_populate_early_shadow(const void *shadow_start,
  	return 0;
  }
 
-void __init __weak kasan_populate_early_vm_area_shadow(void *start,
-						       unsigned long size)
-{
-}
-
  static void kasan_free_pte(pte_t *pte_start, pmd_t *pmd)
  {
  	pte_t *pte;
mm/kasan/shadow.c +5 -0
index 8d95ee52d019..4a4929b29a23 100644
@@ -254,6 +254,11 @@ core_initcall(kasan_memhotplug_init);
 
  #ifdef CONFIG_KASAN_VMALLOC
 
+void __init __weak kasan_populate_early_vm_area_shadow(void *start,
+						       unsigned long size)
+{
+}
+
  static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr,
  				      void *unused)
  {
#3 lore raw
In reply to Naresh Kamboju

+ Andrew Morton <[email protected]>

Quoted 48 lines · Naresh Kamboju

Regression found on x86_64 gcc-11 built with KASAN enabled. Following build warnings / errors reported on linux next 20211011.

metadata:

    git_describe: next-20211011
    git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
    git_short_log: d3134eb5de85 (\"Add linux-next specific files for 20211011\")
    target_arch: x86_64
    toolchain: gcc-11

build error :
--------------
mm/kasan/init.c:282:20: error: redefinition of 'kasan_populate_early_vm_area_shadow'
282 | void __init __weak kasan_populate_early_vm_area_shadow(void *start,

      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:34,
                 from include/linux/memblock.h:13,
                 from mm/kasan/init.c:9:

include/linux/kasan.h:463:20: note: previous definition of 'kasan_populate_early_vm_area_shadow' with type 'void(void *, long unsigned int)'
463 | static inline void kasan_populate_early_vm_area_shadow(void *start,

      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:288: mm/kasan/init.o] Error 1 make[3]: Target '__build' not remade because of errors.

build link:
-----------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/build.log

build config:
-------------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

# To install tuxmake on your system globally

# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-11
--kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

--
Linaro LKFT
https://lkft.linaro.org

maintainer
#4 lore raw
Quoted 47 lines · On Mon, 11 Oct 2021 18:12:44 +0530 Naresh Kamboju <[email protected]>…

+ Andrew Morton <[email protected]>

Quoted 44 lines · Naresh Kamboju

Regression found on x86_64 gcc-11 built with KASAN enabled. Following build warnings / errors reported on linux next 20211011.

metadata:

    git_describe: next-20211011
    git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
    git_short_log: d3134eb5de85 (\"Add linux-next specific files for 20211011\")
    target_arch: x86_64
    toolchain: gcc-11

build error :
--------------
mm/kasan/init.c:282:20: error: redefinition of 'kasan_populate_early_vm_area_shadow'
282 | void __init __weak kasan_populate_early_vm_area_shadow(void *start,

      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:34,
                 from include/linux/memblock.h:13,
                 from mm/kasan/init.c:9:

include/linux/kasan.h:463:20: note: previous definition of 'kasan_populate_early_vm_area_shadow' with type 'void(void *, long unsigned int)'
463 | static inline void kasan_populate_early_vm_area_shadow(void *start,

      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:288: mm/kasan/init.o] Error 1 make[3]: Target '__build' not remade because of errors.

build link:
-----------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/build.log

build config:
-------------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

# To install tuxmake on your system globally

# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-11
--kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

Presumably "kasan: arm64: fix pcpu_page_first_chunk crash with KASAN_VMALLOC". Let's cc Kefeng.

#5 lore raw
Quoted 44 lines · Andrew Morton
Quoted 42 lines · On Mon, 11 Oct 2021 18:12:44 +0530 Naresh Kamboju <[email protected]>…

+ Andrew Morton <[email protected]>

Quoted 39 lines · Naresh Kamboju

Regression found on x86_64 gcc-11 built with KASAN enabled. Following build warnings / errors reported on linux next 20211011.

metadata:

     git_describe: next-20211011
     git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
     git_short_log: d3134eb5de85 (\"Add linux-next specific files for 20211011\")
     target_arch: x86_64
     toolchain: gcc-11

build error :
--------------
mm/kasan/init.c:282:20: error: redefinition of 'kasan_populate_early_vm_area_shadow'
282 | void __init __weak kasan_populate_early_vm_area_shadow(void *start,

       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:34,
                  from include/linux/memblock.h:13,
                  from mm/kasan/init.c:9:

include/linux/kasan.h:463:20: note: previous definition of 'kasan_populate_early_vm_area_shadow' with type 'void(void *, long unsigned int)'
463 | static inline void kasan_populate_early_vm_area_shadow(void *start,

       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:288: mm/kasan/init.o] Error 1 make[3]: Target '__build' not remade because of errors.

build link:
-----------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/build.log

build config:
-------------
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

# To install tuxmake on your system globally

# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-11
--kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1zLv2snHfZN8QV01yA9MB8NhUZt/config

Presumably "kasan: arm64: fix pcpu_page_first_chunk crash with KASAN_VMALLOC". Let's cc Kefeng.

Yes, I send a fix patch, and reply this mail, see
https://lore.kernel.org/linux-mm/[email protected]/

Quoted 3 lines

.