diff mbox series

mm: kasan: Fix redefinition of 'kasan_populate_early_vm_area_shadow'

Message ID 20211011123211.3936196-1-wangkefeng.wang@huawei.com (mailing list archive)
State New
Headers show
Series mm: kasan: Fix redefinition of 'kasan_populate_early_vm_area_shadow' | expand

Commit Message

Kefeng Wang Oct. 11, 2021, 12:32 p.m. UTC
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.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: kasan-dev@googlegroups.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
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(-)

Comments

Kefeng Wang Oct. 11, 2021, 12:22 p.m. UTC | #1
On 2021/10/11 20:32, Kefeng Wang wrote:
> 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.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: kasan-dev@googlegroups.com
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> 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.

> 
>   mm/kasan/init.c   | 5 -----
>   mm/kasan/shadow.c | 5 +++++
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/kasan/init.c b/mm/kasan/init.c
> index d39577d088a1..cc64ed6858c6 100644
> --- a/mm/kasan/init.c
> +++ b/mm/kasan/init.c
> @@ -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;
> diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
> index 8d95ee52d019..4a4929b29a23 100644
> --- a/mm/kasan/shadow.c
> +++ b/mm/kasan/shadow.c
> @@ -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)
>   {
>
diff mbox series

Patch

diff --git a/mm/kasan/init.c b/mm/kasan/init.c
index d39577d088a1..cc64ed6858c6 100644
--- a/mm/kasan/init.c
+++ b/mm/kasan/init.c
@@ -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;
diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index 8d95ee52d019..4a4929b29a23 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -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)
 {