Re: [PATCH v2 0/7] KASan for arm
From: Liuwenliang (Abbott Liu)
Date: Sat Mar 24 2018 - 09:06:23 EST
On 03/20/2018 2:30 AM, Abbott Liu wrote:
>BTW, it looks like you have some section mismatches:
>
>WARNING: vmlinux.o(.meminit.text+0x40): Section mismatch in reference
>from the function kasan_pte_populate() to the function
>.init.text:kasan_alloc_block.constprop.5()
>The function __meminit kasan_pte_populate() references
>a function __init kasan_alloc_block.constprop.5().
>If kasan_alloc_block.constprop.5 is only used by kasan_pte_populate then
>annotate kasan_alloc_block.constprop.5 with a matching annotation.
>
>WARNING: vmlinux.o(.meminit.text+0x144): Section mismatch in reference
>from the function kasan_pmd_populate() to the function
>.init.text:kasan_alloc_block.constprop.5()
>The function __meminit kasan_pmd_populate() references
>a function __init kasan_alloc_block.constprop.5().
>If kasan_alloc_block.constprop.5 is only used by kasan_pmd_populate then
>annotate kasan_alloc_block.constprop.5 with a matching annotation.
>
>WARNING: vmlinux.o(.meminit.text+0x1a4): Section mismatch in reference
>from the function kasan_pud_populate() to the function
>.init.text:kasan_alloc_block.constprop.5()
>The function __meminit kasan_pud_populate() references
>a function __init kasan_alloc_block.constprop.5().
>If kasan_alloc_block.constprop.5 is only used by kasan_pud_populate then
>annotate kasan_alloc_block.constprop.5 with a matching annotation.
Thanks for your testing.
I don't know why the compiler on my machine doesn't report this waring.
Could you test again with adding the following code:
liuwenliang@linux:/home/soft_disk/yocto/linux-git/linux> git diff
diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c
index d316f37..ae14d19 100644
--- a/arch/arm/mm/kasan_init.c
+++ b/arch/arm/mm/kasan_init.c
@@ -115,7 +115,7 @@ static void __init clear_pgds(unsigned long start,
pmd_clear(pmd_off_k(start));
}
-pte_t * __meminit kasan_pte_populate(pmd_t *pmd, unsigned long addr, int node)
+pte_t * __init kasan_pte_populate(pmd_t *pmd, unsigned long addr, int node)
{
pte_t *pte = pte_offset_kernel(pmd, addr);
@@ -132,7 +132,7 @@ pte_t * __meminit kasan_pte_populate(pmd_t *pmd, unsigned long addr, int node)
return pte;
}
-pmd_t * __meminit kasan_pmd_populate(pud_t *pud, unsigned long addr, int node)
+pmd_t * __init kasan_pmd_populate(pud_t *pud, unsigned long addr, int node)
{
pmd_t *pmd = pmd_offset(pud, addr);
@@ -146,7 +146,7 @@ pmd_t * __meminit kasan_pmd_populate(pud_t *pud, unsigned long addr, int node)
return pmd;
}
-pud_t * __meminit kasan_pud_populate(pgd_t *pgd, unsigned long addr, int node)
+pud_t * __init kasan_pud_populate(pgd_t *pgd, unsigned long addr, int node)
{
pud_t *pud = pud_offset(pgd, addr);
@@ -161,7 +161,7 @@ pud_t * __meminit kasan_pud_populate(pgd_t *pgd, unsigned long addr, int node)
return pud;
}
-pgd_t * __meminit kasan_pgd_populate(unsigned long addr, int node)
+pgd_t * __init kasan_pgd_populate(unsigned long addr, int node)
{
pgd_t *pgd = pgd_offset_k(addr);