Message ID | 20210109103252.812517-3-lecopzer@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: kasan: support CONFIG_KASAN_VMALLOC | expand |
On Sat, Jan 09, 2021 at 06:32:50PM +0800, Lecopzer Chen wrote: > Arm64 provide defined macro for KERNEL_START and KERNEL_END, > thus replace them by the abstration instead of using _text and _end. > > Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> > --- > arch/arm64/mm/kasan_init.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c > index 39b218a64279..fa8d7ece895d 100644 > --- a/arch/arm64/mm/kasan_init.c > +++ b/arch/arm64/mm/kasan_init.c > @@ -218,8 +218,8 @@ static void __init kasan_init_shadow(void) > phys_addr_t pa_start, pa_end; > u64 i; > > - kimg_shadow_start = (u64)kasan_mem_to_shadow(_text) & PAGE_MASK; > - kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(_end)); > + kimg_shadow_start = (u64)kasan_mem_to_shadow(KERNEL_START) & PAGE_MASK; > + kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(KERNEL_END)); > > mod_shadow_start = (u64)kasan_mem_to_shadow((void *)MODULES_VADDR); > mod_shadow_end = (u64)kasan_mem_to_shadow((void *)MODULES_END); > @@ -241,7 +241,7 @@ static void __init kasan_init_shadow(void) > clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); > > kasan_map_populate(kimg_shadow_start, kimg_shadow_end, > - early_pfn_to_nid(virt_to_pfn(lm_alias(_text)))); > + early_pfn_to_nid(virt_to_pfn(lm_alias(KERNEL_START)))); To be honest, I think this whole line is pointless. We should be able to pass NUMA_NO_NODE now that we're not abusing the vmemmap() allocator to populate the shadow. Will
> On Sat, Jan 09, 2021 at 06:32:50PM +0800, Lecopzer Chen wrote: > > Arm64 provide defined macro for KERNEL_START and KERNEL_END, > > thus replace them by the abstration instead of using _text and _end. > > > > Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> > > --- > > arch/arm64/mm/kasan_init.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c > > index 39b218a64279..fa8d7ece895d 100644 > > --- a/arch/arm64/mm/kasan_init.c > > +++ b/arch/arm64/mm/kasan_init.c > > @@ -218,8 +218,8 @@ static void __init kasan_init_shadow(void) > > phys_addr_t pa_start, pa_end; > > u64 i; > > > > - kimg_shadow_start = (u64)kasan_mem_to_shadow(_text) & PAGE_MASK; > > - kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(_end)); > > + kimg_shadow_start = (u64)kasan_mem_to_shadow(KERNEL_START) & PAGE_MASK; > > + kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(KERNEL_END)); > > > > mod_shadow_start = (u64)kasan_mem_to_shadow((void *)MODULES_VADDR); > > mod_shadow_end = (u64)kasan_mem_to_shadow((void *)MODULES_END); > > @@ -241,7 +241,7 @@ static void __init kasan_init_shadow(void) > > clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); > > > > kasan_map_populate(kimg_shadow_start, kimg_shadow_end, > > - early_pfn_to_nid(virt_to_pfn(lm_alias(_text)))); > > + early_pfn_to_nid(virt_to_pfn(lm_alias(KERNEL_START)))); > > To be honest, I think this whole line is pointless. We should be able to > pass NUMA_NO_NODE now that we're not abusing the vmemmap() allocator to > populate the shadow. Do we need to fix this in this series? it seems another topic. If not, should this patch be removed in this series? Thanks, Lecopzer
On Thu, Feb 04, 2021 at 10:51:27PM +0800, Lecopzer Chen wrote: > > On Sat, Jan 09, 2021 at 06:32:50PM +0800, Lecopzer Chen wrote: > > > Arm64 provide defined macro for KERNEL_START and KERNEL_END, > > > thus replace them by the abstration instead of using _text and _end. > > > > > > Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> > > > --- > > > arch/arm64/mm/kasan_init.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c > > > index 39b218a64279..fa8d7ece895d 100644 > > > --- a/arch/arm64/mm/kasan_init.c > > > +++ b/arch/arm64/mm/kasan_init.c > > > @@ -218,8 +218,8 @@ static void __init kasan_init_shadow(void) > > > phys_addr_t pa_start, pa_end; > > > u64 i; > > > > > > - kimg_shadow_start = (u64)kasan_mem_to_shadow(_text) & PAGE_MASK; > > > - kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(_end)); > > > + kimg_shadow_start = (u64)kasan_mem_to_shadow(KERNEL_START) & PAGE_MASK; > > > + kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(KERNEL_END)); > > > > > > mod_shadow_start = (u64)kasan_mem_to_shadow((void *)MODULES_VADDR); > > > mod_shadow_end = (u64)kasan_mem_to_shadow((void *)MODULES_END); > > > @@ -241,7 +241,7 @@ static void __init kasan_init_shadow(void) > > > clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); > > > > > > kasan_map_populate(kimg_shadow_start, kimg_shadow_end, > > > - early_pfn_to_nid(virt_to_pfn(lm_alias(_text)))); > > > + early_pfn_to_nid(virt_to_pfn(lm_alias(KERNEL_START)))); > > > > To be honest, I think this whole line is pointless. We should be able to > > pass NUMA_NO_NODE now that we're not abusing the vmemmap() allocator to > > populate the shadow. > > Do we need to fix this in this series? it seems another topic. > If not, should this patch be removed in this series? Since you're reposting anyway, you may as well include a patch doing that. If you don't, then I will. Will
I think it would be better to leave this for you since I'm not familiar with the relationship between vmemmap() and NUMA_NO_NODE. So I would just keep this patch in next version, is this fine with you? Thanks for your help:) Lecopzer Will Deacon <will@kernel.org> 於 2021年2月4日 週四 下午10:55寫道: > > On Thu, Feb 04, 2021 at 10:51:27PM +0800, Lecopzer Chen wrote: > > > On Sat, Jan 09, 2021 at 06:32:50PM +0800, Lecopzer Chen wrote: > > > > Arm64 provide defined macro for KERNEL_START and KERNEL_END, > > > > thus replace them by the abstration instead of using _text and _end. > > > > > > > > Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> > > > > --- > > > > arch/arm64/mm/kasan_init.c | 6 +++--- > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c > > > > index 39b218a64279..fa8d7ece895d 100644 > > > > --- a/arch/arm64/mm/kasan_init.c > > > > +++ b/arch/arm64/mm/kasan_init.c > > > > @@ -218,8 +218,8 @@ static void __init kasan_init_shadow(void) > > > > phys_addr_t pa_start, pa_end; > > > > u64 i; > > > > > > > > - kimg_shadow_start = (u64)kasan_mem_to_shadow(_text) & PAGE_MASK; > > > > - kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(_end)); > > > > + kimg_shadow_start = (u64)kasan_mem_to_shadow(KERNEL_START) & PAGE_MASK; > > > > + kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(KERNEL_END)); > > > > > > > > mod_shadow_start = (u64)kasan_mem_to_shadow((void *)MODULES_VADDR); > > > > mod_shadow_end = (u64)kasan_mem_to_shadow((void *)MODULES_END); > > > > @@ -241,7 +241,7 @@ static void __init kasan_init_shadow(void) > > > > clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); > > > > > > > > kasan_map_populate(kimg_shadow_start, kimg_shadow_end, > > > > - early_pfn_to_nid(virt_to_pfn(lm_alias(_text)))); > > > > + early_pfn_to_nid(virt_to_pfn(lm_alias(KERNEL_START)))); > > > > > > To be honest, I think this whole line is pointless. We should be able to > > > pass NUMA_NO_NODE now that we're not abusing the vmemmap() allocator to > > > populate the shadow. > > > > Do we need to fix this in this series? it seems another topic. > > If not, should this patch be removed in this series? > > Since you're reposting anyway, you may as well include a patch doing that. > If you don't, then I will. > > Will
On Fri, Feb 05, 2021 at 12:06:10AM +0800, Lecopzer Chen wrote: > I think it would be better to leave this for you since I'm not > familiar with the relationship > between vmemmap() and NUMA_NO_NODE. > > So I would just keep this patch in next version, is this fine with you? Yes, ok. Will
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c index 39b218a64279..fa8d7ece895d 100644 --- a/arch/arm64/mm/kasan_init.c +++ b/arch/arm64/mm/kasan_init.c @@ -218,8 +218,8 @@ static void __init kasan_init_shadow(void) phys_addr_t pa_start, pa_end; u64 i; - kimg_shadow_start = (u64)kasan_mem_to_shadow(_text) & PAGE_MASK; - kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(_end)); + kimg_shadow_start = (u64)kasan_mem_to_shadow(KERNEL_START) & PAGE_MASK; + kimg_shadow_end = PAGE_ALIGN((u64)kasan_mem_to_shadow(KERNEL_END)); mod_shadow_start = (u64)kasan_mem_to_shadow((void *)MODULES_VADDR); mod_shadow_end = (u64)kasan_mem_to_shadow((void *)MODULES_END); @@ -241,7 +241,7 @@ static void __init kasan_init_shadow(void) clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); kasan_map_populate(kimg_shadow_start, kimg_shadow_end, - early_pfn_to_nid(virt_to_pfn(lm_alias(_text)))); + early_pfn_to_nid(virt_to_pfn(lm_alias(KERNEL_START)))); kasan_populate_early_shadow(kasan_mem_to_shadow((void *)PAGE_END), (void *)mod_shadow_start);
Arm64 provide defined macro for KERNEL_START and KERNEL_END, thus replace them by the abstration instead of using _text and _end. Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> --- arch/arm64/mm/kasan_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)