Re: [PATCH v2 33/37] kasan, arm64: implement HW_TAGS runtime
From: Andrey Konovalov
Date: Fri Sep 18 2020 - 11:52:34 EST
On Fri, Sep 18, 2020 at 5:19 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Tue, Sep 15, 2020 at 11:16PM +0200, Andrey Konovalov wrote:
>
> > diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> > index 875bbcedd994..613c9d38eee5 100644
> > --- a/include/linux/kasan.h
> > +++ b/include/linux/kasan.h
> > @@ -184,7 +184,7 @@ static inline void kasan_record_aux_stack(void *ptr) {}
> >
> > #endif /* CONFIG_KASAN_GENERIC */
> >
> > -#ifdef CONFIG_KASAN_SW_TAGS
> > +#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
> >
> > void kasan_init_tags(void);
> >
> > @@ -193,7 +193,7 @@ void *kasan_reset_tag(const void *addr);
> > bool kasan_report(unsigned long addr, size_t size,
> > bool is_write, unsigned long ip);
> >
> > -#else /* CONFIG_KASAN_SW_TAGS */
> > +#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */
> >
> > static inline void kasan_init_tags(void) { }
> >
> > @@ -202,7 +202,7 @@ static inline void *kasan_reset_tag(const void *addr)
> > return (void *)addr;
> > }
> >
> > -#endif /* CONFIG_KASAN_SW_TAGS */
> > +#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS*/
> >
> > #ifdef CONFIG_KASAN_VMALLOC
>
> It's not visible by looking at this diff, but there is some
> #ifdef-redundancy that I do not understand where it came from.
>
> This is what I have to fix it:
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 613c9d38eee5..80a0e5b11f2b 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -40,6 +40,12 @@ static inline void *kasan_mem_to_shadow(const void *addr)
> int kasan_add_zero_shadow(void *start, unsigned long size);
> void kasan_remove_zero_shadow(void *start, unsigned long size);
>
> +/* Enable reporting bugs after kasan_disable_current() */
> +extern void kasan_enable_current(void);
> +
> +/* Disable reporting bugs for current task */
> +extern void kasan_disable_current(void);
> +
> #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
>
> static inline int kasan_add_zero_shadow(void *start, unsigned long size)
> @@ -50,18 +56,6 @@ static inline void kasan_remove_zero_shadow(void *start,
> unsigned long size)
> {}
>
> -#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
> -
> -#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
> -
> -/* Enable reporting bugs after kasan_disable_current() */
> -extern void kasan_enable_current(void);
> -
> -/* Disable reporting bugs for current task */
> -extern void kasan_disable_current(void);
> -
> -#else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
> -
> static inline void kasan_enable_current(void) {}
> static inline void kasan_disable_current(void) {}
Oh yeah, I'll fix this, thanks!