All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kasan: fix build by including kernel.h
@ 2021-07-05  7:27 ` Marco Elver
  0 siblings, 0 replies; 9+ messages in thread
From: Marco Elver @ 2021-07-05  7:27 UTC (permalink / raw)
  To: elver, akpm
  Cc: glider, dvyukov, pcc, catalin.marinas, vincenzo.frascino,
	linux-kernel, linux-mm, kasan-dev, ryabinin.a.a, andreyknvl,
	Andy Shevchenko

The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
been receiving that definition via inclusion of bug.h which includes
kernel.h. However, since f39650de687e that is no longer the case and get
the following build error when building CONFIG_KASAN_HW_TAGS on arm64:

  In file included from arch/arm64/mm/kasan_init.c:10:
  ./include/linux/kasan.h: In function 'kasan_slab_free':
  ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
    230 |   return __kasan_slab_free(s, object, _RET_IP_, init);

Fix it by including kernel.h from kasan.h.

Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Marco Elver <elver@google.com>
---
 include/linux/kasan.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 5310e217bd74..dd874a1ee862 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -3,6 +3,7 @@
 #define _LINUX_KASAN_H
 
 #include <linux/bug.h>
+#include <linux/kernel.h>
 #include <linux/static_key.h>
 #include <linux/types.h>
 
-- 
2.32.0.93.g670b81a890-goog


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] kasan: fix build by including kernel.h
@ 2021-07-05  7:27 ` Marco Elver
  0 siblings, 0 replies; 9+ messages in thread
From: Marco Elver @ 2021-07-05  7:27 UTC (permalink / raw)
  To: elver, akpm
  Cc: glider, dvyukov, pcc, catalin.marinas, vincenzo.frascino,
	linux-kernel, linux-mm, kasan-dev, ryabinin.a.a, andreyknvl,
	Andy Shevchenko

The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
been receiving that definition via inclusion of bug.h which includes
kernel.h. However, since f39650de687e that is no longer the case and get
the following build error when building CONFIG_KASAN_HW_TAGS on arm64:

  In file included from arch/arm64/mm/kasan_init.c:10:
  ./include/linux/kasan.h: In function 'kasan_slab_free':
  ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
    230 |   return __kasan_slab_free(s, object, _RET_IP_, init);

Fix it by including kernel.h from kasan.h.

Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Marco Elver <elver@google.com>
---
 include/linux/kasan.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 5310e217bd74..dd874a1ee862 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -3,6 +3,7 @@
 #define _LINUX_KASAN_H
 
 #include <linux/bug.h>
+#include <linux/kernel.h>
 #include <linux/static_key.h>
 #include <linux/types.h>
 
-- 
2.32.0.93.g670b81a890-goog



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
  2021-07-05  7:27 ` Marco Elver
@ 2021-07-05  8:49   ` Andy Shevchenko
  -1 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2021-07-05  8:49 UTC (permalink / raw)
  To: Marco Elver
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov, pcc,
	Catalin Marinas, Vincenzo Frascino, Linux Kernel Mailing List,
	linux-mm, kasan-dev, Andrey Ryabinin, Andrey Konovalov,
	Andy Shevchenko

On Mon, Jul 5, 2021 at 10:28 AM Marco Elver <elver@google.com> wrote:
>
> The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> been receiving that definition via inclusion of bug.h which includes
> kernel.h. However, since f39650de687e that is no longer the case and get
> the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
>
>   In file included from arch/arm64/mm/kasan_init.c:10:
>   ./include/linux/kasan.h: In function 'kasan_slab_free':
>   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
>     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
>
> Fix it by including kernel.h from kasan.h.

...which I would like to avoid in the long term, but for now it's
probably the best quick fix, otherwise it will require the real split
of _RET_IP or at least rethinking its location.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.org>
Thanks!

> Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")

P.S. I have tested the initial patch against full build of x86_64, and
it was long time available for different CIs/build bots, none
complained so far.

> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Marco Elver <elver@google.com>
> ---
>  include/linux/kasan.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 5310e217bd74..dd874a1ee862 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -3,6 +3,7 @@
>  #define _LINUX_KASAN_H
>
>  #include <linux/bug.h>
> +#include <linux/kernel.h>
>  #include <linux/static_key.h>
>  #include <linux/types.h>
>
> --
> 2.32.0.93.g670b81a890-goog
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
@ 2021-07-05  8:49   ` Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2021-07-05  8:49 UTC (permalink / raw)
  To: Marco Elver
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov, pcc,
	Catalin Marinas, Vincenzo Frascino, Linux Kernel Mailing List,
	linux-mm, kasan-dev, Andrey Ryabinin, Andrey Konovalov,
	Andy Shevchenko

On Mon, Jul 5, 2021 at 10:28 AM Marco Elver <elver@google.com> wrote:
>
> The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> been receiving that definition via inclusion of bug.h which includes
> kernel.h. However, since f39650de687e that is no longer the case and get
> the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
>
>   In file included from arch/arm64/mm/kasan_init.c:10:
>   ./include/linux/kasan.h: In function 'kasan_slab_free':
>   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
>     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
>
> Fix it by including kernel.h from kasan.h.

...which I would like to avoid in the long term, but for now it's
probably the best quick fix, otherwise it will require the real split
of _RET_IP or at least rethinking its location.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.org>
Thanks!

> Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")

P.S. I have tested the initial patch against full build of x86_64, and
it was long time available for different CIs/build bots, none
complained so far.

> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Marco Elver <elver@google.com>
> ---
>  include/linux/kasan.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 5310e217bd74..dd874a1ee862 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -3,6 +3,7 @@
>  #define _LINUX_KASAN_H
>
>  #include <linux/bug.h>
> +#include <linux/kernel.h>
>  #include <linux/static_key.h>
>  #include <linux/types.h>
>
> --
> 2.32.0.93.g670b81a890-goog
>


-- 
With Best Regards,
Andy Shevchenko


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
  2021-07-05  8:49   ` Andy Shevchenko
@ 2021-07-05  9:01     ` Marco Elver
  -1 siblings, 0 replies; 9+ messages in thread
From: Marco Elver @ 2021-07-05  9:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov, pcc,
	Catalin Marinas, Vincenzo Frascino, Linux Kernel Mailing List,
	linux-mm, kasan-dev, Andrey Ryabinin, Andrey Konovalov,
	Andy Shevchenko

On Mon, 5 Jul 2021 at 10:50, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Mon, Jul 5, 2021 at 10:28 AM Marco Elver <elver@google.com> wrote:
> > The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> > been receiving that definition via inclusion of bug.h which includes
> > kernel.h. However, since f39650de687e that is no longer the case and get
> > the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
> >
> >   In file included from arch/arm64/mm/kasan_init.c:10:
> >   ./include/linux/kasan.h: In function 'kasan_slab_free':
> >   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
> >     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
> >
> > Fix it by including kernel.h from kasan.h.
>
> ...which I would like to avoid in the long term, but for now it's
> probably the best quick fix, otherwise it will require the real split
> of _RET_IP or at least rethinking its location.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.org>
> Thanks!

Thanks!

> > Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
>
> P.S. I have tested the initial patch against full build of x86_64, and
> it was long time available for different CIs/build bots, none
> complained so far.

It only manifests on arm64 when using CONFIG_KASAN_HW_TAGS mode
(requires Arm64 MTE extensions). The other 2 modes include
<linux/pgtable.h> in kasan.h, and that seems to include kernel.h
somewhere. The HW_TAGS mode, however, doesn't receive -next testing by
a CI system AFAIK, so this was missed because it's not yet used by
many (I'd expect that to change when CPUs with MTE are more
widespread).

Thanks,
-- Marco

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
@ 2021-07-05  9:01     ` Marco Elver
  0 siblings, 0 replies; 9+ messages in thread
From: Marco Elver @ 2021-07-05  9:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov, pcc,
	Catalin Marinas, Vincenzo Frascino, Linux Kernel Mailing List,
	linux-mm, kasan-dev, Andrey Ryabinin, Andrey Konovalov,
	Andy Shevchenko

On Mon, 5 Jul 2021 at 10:50, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Mon, Jul 5, 2021 at 10:28 AM Marco Elver <elver@google.com> wrote:
> > The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> > been receiving that definition via inclusion of bug.h which includes
> > kernel.h. However, since f39650de687e that is no longer the case and get
> > the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
> >
> >   In file included from arch/arm64/mm/kasan_init.c:10:
> >   ./include/linux/kasan.h: In function 'kasan_slab_free':
> >   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
> >     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
> >
> > Fix it by including kernel.h from kasan.h.
>
> ...which I would like to avoid in the long term, but for now it's
> probably the best quick fix, otherwise it will require the real split
> of _RET_IP or at least rethinking its location.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.org>
> Thanks!

Thanks!

> > Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
>
> P.S. I have tested the initial patch against full build of x86_64, and
> it was long time available for different CIs/build bots, none
> complained so far.

It only manifests on arm64 when using CONFIG_KASAN_HW_TAGS mode
(requires Arm64 MTE extensions). The other 2 modes include
<linux/pgtable.h> in kasan.h, and that seems to include kernel.h
somewhere. The HW_TAGS mode, however, doesn't receive -next testing by
a CI system AFAIK, so this was missed because it's not yet used by
many (I'd expect that to change when CPUs with MTE are more
widespread).

Thanks,
-- Marco


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
  2021-07-05  7:27 ` Marco Elver
@ 2021-07-05 14:41   ` Andrey Konovalov
  -1 siblings, 0 replies; 9+ messages in thread
From: Andrey Konovalov @ 2021-07-05 14:41 UTC (permalink / raw)
  To: Marco Elver
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov,
	Peter Collingbourne, Catalin Marinas, Vincenzo Frascino, LKML,
	Linux Memory Management List, kasan-dev, Andrey Ryabinin,
	Andy Shevchenko

On Mon, Jul 5, 2021 at 9:27 AM Marco Elver <elver@google.com> wrote:
>
> The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> been receiving that definition via inclusion of bug.h which includes
> kernel.h. However, since f39650de687e that is no longer the case and get
> the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
>
>   In file included from arch/arm64/mm/kasan_init.c:10:
>   ./include/linux/kasan.h: In function 'kasan_slab_free':
>   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
>     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
>
> Fix it by including kernel.h from kasan.h.
>
> Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Marco Elver <elver@google.com>
> ---
>  include/linux/kasan.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 5310e217bd74..dd874a1ee862 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -3,6 +3,7 @@
>  #define _LINUX_KASAN_H
>
>  #include <linux/bug.h>
> +#include <linux/kernel.h>
>  #include <linux/static_key.h>
>  #include <linux/types.h>
>
> --
> 2.32.0.93.g670b81a890-goog
>

Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
@ 2021-07-05 14:41   ` Andrey Konovalov
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Konovalov @ 2021-07-05 14:41 UTC (permalink / raw)
  To: Marco Elver
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov,
	Peter Collingbourne, Catalin Marinas, Vincenzo Frascino, LKML,
	Linux Memory Management List, kasan-dev, Andrey Ryabinin,
	Andy Shevchenko

On Mon, Jul 5, 2021 at 9:27 AM Marco Elver <elver@google.com> wrote:
>
> The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> been receiving that definition via inclusion of bug.h which includes
> kernel.h. However, since f39650de687e that is no longer the case and get
> the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
>
>   In file included from arch/arm64/mm/kasan_init.c:10:
>   ./include/linux/kasan.h: In function 'kasan_slab_free':
>   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
>     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
>
> Fix it by including kernel.h from kasan.h.
>
> Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Marco Elver <elver@google.com>
> ---
>  include/linux/kasan.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 5310e217bd74..dd874a1ee862 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -3,6 +3,7 @@
>  #define _LINUX_KASAN_H
>
>  #include <linux/bug.h>
> +#include <linux/kernel.h>
>  #include <linux/static_key.h>
>  #include <linux/types.h>
>
> --
> 2.32.0.93.g670b81a890-goog
>

Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] kasan: fix build by including kernel.h
  2021-07-05  9:01     ` Marco Elver
  (?)
@ 2021-07-06  9:49     ` Andy Shevchenko
  -1 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2021-07-06  9:49 UTC (permalink / raw)
  To: Marco Elver
  Cc: Andrew Morton, Alexander Potapenko, Dmitry Vyukov, pcc,
	Catalin Marinas, Vincenzo Frascino, Linux Kernel Mailing List,
	linux-mm, kasan-dev, Andrey Ryabinin, Andrey Konovalov

On Mon, Jul 05, 2021 at 11:01:44AM +0200, Marco Elver wrote:
> On Mon, 5 Jul 2021 at 10:50, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > On Mon, Jul 5, 2021 at 10:28 AM Marco Elver <elver@google.com> wrote:
> > > The <linux/kasan.h> header relies on _RET_IP_ being defined, and had
> > > been receiving that definition via inclusion of bug.h which includes
> > > kernel.h. However, since f39650de687e that is no longer the case and get
> > > the following build error when building CONFIG_KASAN_HW_TAGS on arm64:
> > >
> > >   In file included from arch/arm64/mm/kasan_init.c:10:
> > >   ./include/linux/kasan.h: In function 'kasan_slab_free':
> > >   ./include/linux/kasan.h:230:39: error: '_RET_IP_' undeclared (first use in this function)
> > >     230 |   return __kasan_slab_free(s, object, _RET_IP_, init);
> > >
> > > Fix it by including kernel.h from kasan.h.
> >
> > ...which I would like to avoid in the long term, but for now it's
> > probably the best quick fix, otherwise it will require the real split
> > of _RET_IP or at least rethinking its location.
> >
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.org>
> > Thanks!
> 
> Thanks!

Should be:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> > > Fixes: f39650de687e ("kernel.h: split out panic and oops helpers")
> >
> > P.S. I have tested the initial patch against full build of x86_64, and
> > it was long time available for different CIs/build bots, none
> > complained so far.
> 
> It only manifests on arm64 when using CONFIG_KASAN_HW_TAGS mode
> (requires Arm64 MTE extensions). The other 2 modes include
> <linux/pgtable.h> in kasan.h, and that seems to include kernel.h
> somewhere. The HW_TAGS mode, however, doesn't receive -next testing by
> a CI system AFAIK, so this was missed because it's not yet used by
> many (I'd expect that to change when CPUs with MTE are more
> widespread).

Got it.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-06  9:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05  7:27 [PATCH] kasan: fix build by including kernel.h Marco Elver
2021-07-05  7:27 ` Marco Elver
2021-07-05  8:49 ` Andy Shevchenko
2021-07-05  8:49   ` Andy Shevchenko
2021-07-05  9:01   ` Marco Elver
2021-07-05  9:01     ` Marco Elver
2021-07-06  9:49     ` Andy Shevchenko
2021-07-05 14:41 ` Andrey Konovalov
2021-07-05 14:41   ` Andrey Konovalov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.