diff mbox series

kasan: export kasan_poison

Message ID 20210125112831.2156212-1-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series kasan: export kasan_poison | expand

Commit Message

Arnd Bergmann Jan. 25, 2021, 11:28 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The unit test module fails to build after adding a reference
to kasan_poison:

ERROR: modpost: "kasan_poison" [lib/test_kasan.ko] undefined!

Export this symbol to make it available to loadable modules.

Fixes: b9b322c2bba9 ("kasan: add match-all tag tests")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 mm/kasan/shadow.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Vincenzo Frascino Jan. 25, 2021, 11:35 a.m. UTC | #1
On 1/25/21 11:28 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The unit test module fails to build after adding a reference
> to kasan_poison:
> 
> ERROR: modpost: "kasan_poison" [lib/test_kasan.ko] undefined!
> 
> Export this symbol to make it available to loadable modules.
> 
> Fixes: b9b322c2bba9 ("kasan: add match-all tag tests")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks I just stumbled on the same issue ;)

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>  mm/kasan/shadow.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
> index de6b3f074742..32e7a5c148e6 100644
> --- a/mm/kasan/shadow.c
> +++ b/mm/kasan/shadow.c
> @@ -94,6 +94,7 @@ void kasan_poison(const void *address, size_t size, u8 value)
>  
>  	__memset(shadow_start, value, shadow_end - shadow_start);
>  }
> +EXPORT_SYMBOL_GPL(kasan_poison);
>  
>  void kasan_unpoison(const void *address, size_t size)
>  {
>
Andrey Konovalov Jan. 27, 2021, 9:25 p.m. UTC | #2
On Mon, Jan 25, 2021 at 12:28 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The unit test module fails to build after adding a reference
> to kasan_poison:
>
> ERROR: modpost: "kasan_poison" [lib/test_kasan.ko] undefined!
>
> Export this symbol to make it available to loadable modules.

Could you share the config you used to trigger this?

> Fixes: b9b322c2bba9 ("kasan: add match-all tag tests")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  mm/kasan/shadow.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
> index de6b3f074742..32e7a5c148e6 100644
> --- a/mm/kasan/shadow.c
> +++ b/mm/kasan/shadow.c
> @@ -94,6 +94,7 @@ void kasan_poison(const void *address, size_t size, u8 value)
>
>         __memset(shadow_start, value, shadow_end - shadow_start);
>  }
> +EXPORT_SYMBOL_GPL(kasan_poison);

Should this be _GPL? All of the other EXPORT_SYMBOL() we use in KASAN
are without the GPL suffix.

>
>  void kasan_unpoison(const void *address, size_t size)
>  {
> --
> 2.29.2
>
Andrey Konovalov Jan. 27, 2021, 9:48 p.m. UTC | #3
On Wed, Jan 27, 2021 at 10:25 PM Andrey Konovalov <andreyknvl@google.com> wrote:
>
> On Mon, Jan 25, 2021 at 12:28 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The unit test module fails to build after adding a reference
> > to kasan_poison:
> >
> > ERROR: modpost: "kasan_poison" [lib/test_kasan.ko] undefined!
> >
> > Export this symbol to make it available to loadable modules.
>
> Could you share the config you used to trigger this?

Never mind, I realized I've been using a branch that already contains
your fix :)
Arnd Bergmann Jan. 27, 2021, 10:36 p.m. UTC | #4
On Wed, Jan 27, 2021 at 10:25 PM Andrey Konovalov <andreyknvl@google.com> wrote:
> On Mon, Jan 25, 2021 at 12:28 PM Arnd Bergmann <arnd@kernel.org> wrote:
> > diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
> > index de6b3f074742..32e7a5c148e6 100644
> > --- a/mm/kasan/shadow.c
> > +++ b/mm/kasan/shadow.c
> > @@ -94,6 +94,7 @@ void kasan_poison(const void *address, size_t size, u8 value)
> >
> >         __memset(shadow_start, value, shadow_end - shadow_start);
> >  }
> > +EXPORT_SYMBOL_GPL(kasan_poison);
>
> Should this be _GPL? All of the other EXPORT_SYMBOL() we use in KASAN
> are without the GPL suffix.

I don't care much either way, the reason I went for the _GPL  variant
was that this
seems to only be used internally in mm/kasan/ and lib/test_kasan.c,
unlike the other
symbols that are meant to be called by other modules.

         Arnd
diff mbox series

Patch

diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index de6b3f074742..32e7a5c148e6 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -94,6 +94,7 @@  void kasan_poison(const void *address, size_t size, u8 value)
 
 	__memset(shadow_start, value, shadow_end - shadow_start);
 }
+EXPORT_SYMBOL_GPL(kasan_poison);
 
 void kasan_unpoison(const void *address, size_t size)
 {