All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
@ 2018-07-30 17:06 Nick Desaulniers
  2018-07-30 18:39 ` Nathan Chancellor
  2018-07-31  6:50 ` kbuild test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Desaulniers @ 2018-07-30 17:06 UTC (permalink / raw)
  To: akpm
  Cc: mka, ghackmann, ghackmann, Nick Desaulniers, stable, Kees Cook,
	Ingo Molnar, Greg Kroah-Hartman, Josh Poimboeuf, Wei Wang,
	Masahiro Yamada, Randy Dunlap, NeilBrown, linux-kernel

Starting with Clang-7.0, _THIS_IP_ generates -Wreturn-stack-address
warnings for almost every translation unit. In general, I'd prefer to
leave this on (returning the address of a stack allocated variable is in
general a bad idea) and disable it only at whitelisted call sites.

We can't do something like:
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-stack-address"
 <code>
 #pragma clang diagnostic pop

in a GNU Statement Expression or macro, hence we use _Pragma, which is
its raison d'être: https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html

Cc: stable@vger.kernel.org # 4.17, 4.14, 4.9, 4.4
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 include/linux/kernel.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 941dc0a5a877..5906f5727f90 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -168,7 +168,15 @@
 
 
 #define _RET_IP_		(unsigned long)__builtin_return_address(0)
-#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
+#define _THIS_IP_  (							\
+{									\
+	_Pragma("clang diagnostic push")				\
+	_Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"")	\
+	__label__ __here;						\
+__here: (unsigned long)&&__here;					\
+	_Pragma("clang diagnostic pop")					\
+}									\
+)
 
 #ifdef CONFIG_LBDAF
 # include <asm/div64.h>
-- 
2.18.0.233.g985f88cf7e-goog


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

* Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
  2018-07-30 17:06 [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_ Nick Desaulniers
@ 2018-07-30 18:39 ` Nathan Chancellor
  2018-07-30 19:48   ` Nick Desaulniers
  2018-07-31  6:50 ` kbuild test robot
  1 sibling, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2018-07-30 18:39 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: akpm, mka, ghackmann, ghackmann, stable, Kees Cook, Ingo Molnar,
	Greg Kroah-Hartman, Josh Poimboeuf, Wei Wang, Masahiro Yamada,
	Randy Dunlap, NeilBrown, linux-kernel

On Mon, Jul 30, 2018 at 10:06:20AM -0700, Nick Desaulniers wrote:
> Starting with Clang-7.0, _THIS_IP_ generates -Wreturn-stack-address
> warnings for almost every translation unit. In general, I'd prefer to
> leave this on (returning the address of a stack allocated variable is in
> general a bad idea) and disable it only at whitelisted call sites.
> 
> We can't do something like:
>  #pragma clang diagnostic push
>  #pragma clang diagnostic ignored "-Wreturn-stack-address"
>  <code>
>  #pragma clang diagnostic pop
> 
> in a GNU Statement Expression or macro, hence we use _Pragma, which is
> its raison d'être: https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
> 
> Cc: stable@vger.kernel.org # 4.17, 4.14, 4.9, 4.4
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  include/linux/kernel.h | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 941dc0a5a877..5906f5727f90 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -168,7 +168,15 @@
>  
>  
>  #define _RET_IP_		(unsigned long)__builtin_return_address(0)
> -#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
> +#define _THIS_IP_  (							\
> +{									\
> +	_Pragma("clang diagnostic push")				\
> +	_Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"")	\
> +	__label__ __here;						\
> +__here: (unsigned long)&&__here;					\
> +	_Pragma("clang diagnostic pop")					\
> +}									\
> +)
>  
>  #ifdef CONFIG_LBDAF
>  # include <asm/div64.h>
> -- 
> 2.18.0.233.g985f88cf7e-goog
> 

This generates a ton of warnings with GCC:

In file included from ./include/linux/spinlock.h:58,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/slab.h:15,
                 from ./include/linux/crypto.h:24,
                 from arch/x86/kernel/asm-offsets.c:9:
./include/linux/bottom_half.h: In function ‘local_bh_disable’:
./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
  __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);

./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]   
./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]                             
./include/linux/bottom_half.h: In function ‘local_bh_enable’:
./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
  __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);

./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
cc1: all warnings being treated as errors
make[1]: *** [Kbuild:56: arch/x86/kernel/asm-offsets.s] Error 1
make: *** [Makefile:1081: prepare0] Error 2

A proper solution is probably going to involve what was done for the
-Wattribute-alias warnings from GCC 8 in commits 8793bb7f4a9d ("kbuild:
add macro for controlling warnings to linux/compiler.h") and
bee20031772a ("disable -Wattribute-alias warning for SYSCALL_DEFINEx()")

I'll take a look at it in a bit unless someone beats me to it.

Thanks!
Nathan

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

* Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
  2018-07-30 18:39 ` Nathan Chancellor
@ 2018-07-30 19:48   ` Nick Desaulniers
  2018-07-30 20:01     ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Desaulniers @ 2018-07-30 19:48 UTC (permalink / raw)
  To: natechancellor
  Cc: Andrew Morton, Matthias Kaehlcke, ghackmann, Greg Hackmann,
	stable, Kees Cook, Ingo Molnar, Greg KH, Josh Poimboeuf,
	Wei Wang, Masahiro Yamada, rdunlap, neilb, LKML

On Mon, Jul 30, 2018 at 11:39 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Mon, Jul 30, 2018 at 10:06:20AM -0700, Nick Desaulniers wrote:
> > Starting with Clang-7.0, _THIS_IP_ generates -Wreturn-stack-address
> > warnings for almost every translation unit. In general, I'd prefer to
> > leave this on (returning the address of a stack allocated variable is in
> > general a bad idea) and disable it only at whitelisted call sites.
> >
> > We can't do something like:
> >  #pragma clang diagnostic push
> >  #pragma clang diagnostic ignored "-Wreturn-stack-address"
> >  <code>
> >  #pragma clang diagnostic pop
> >
> > in a GNU Statement Expression or macro, hence we use _Pragma, which is
> > its raison d'être: https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
> >
> > Cc: stable@vger.kernel.org # 4.17, 4.14, 4.9, 4.4
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> >  include/linux/kernel.h | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index 941dc0a5a877..5906f5727f90 100644
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > @@ -168,7 +168,15 @@
> >
> >
> >  #define _RET_IP_             (unsigned long)__builtin_return_address(0)
> > -#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
> > +#define _THIS_IP_  (                                                 \
> > +{                                                                    \
> > +     _Pragma("clang diagnostic push")                                \
> > +     _Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"")  \
> > +     __label__ __here;                                               \
> > +__here: (unsigned long)&&__here;                                     \
> > +     _Pragma("clang diagnostic pop")                                 \
> > +}                                                                    \
> > +)
> >
> >  #ifdef CONFIG_LBDAF
> >  # include <asm/div64.h>
> > --
> > 2.18.0.233.g985f88cf7e-goog
> >
>
> This generates a ton of warnings with GCC:
>
> In file included from ./include/linux/spinlock.h:58,
>                  from ./include/linux/mmzone.h:8,
>                  from ./include/linux/gfp.h:6,
>                  from ./include/linux/slab.h:15,
>                  from ./include/linux/crypto.h:24,
>                  from arch/x86/kernel/asm-offsets.c:9:
> ./include/linux/bottom_half.h: In function ‘local_bh_disable’:
> ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
>   __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> ./include/linux/bottom_half.h: In function ‘local_bh_enable’:
> ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
>   __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> cc1: all warnings being treated as errors
> make[1]: *** [Kbuild:56: arch/x86/kernel/asm-offsets.s] Error 1
> make: *** [Makefile:1081: prepare0] Error 2

Ah, good catch.  I thought I had tested locally with gcc-8, but it
seems that it was likely only godbolt.  I do see the errors locally
when building with gcc-8.

>
> A proper solution is probably going to involve what was done for the
> -Wattribute-alias warnings from GCC 8 in commits 8793bb7f4a9d ("kbuild:
> add macro for controlling warnings to linux/compiler.h") and
> bee20031772a ("disable -Wattribute-alias warning for SYSCALL_DEFINEx()")
>
> I'll take a look at it in a bit unless someone beats me to it.

I'll fix this up, triple check with gcc-8, and attribute you in the
Suggested-by tag.  Thank you for verifying.
-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
  2018-07-30 19:48   ` Nick Desaulniers
@ 2018-07-30 20:01     ` Nathan Chancellor
  2018-07-30 21:15       ` Nick Desaulniers
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2018-07-30 20:01 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Andrew Morton, Matthias Kaehlcke, ghackmann, Greg Hackmann,
	stable, Kees Cook, Ingo Molnar, Greg KH, Josh Poimboeuf,
	Wei Wang, Masahiro Yamada, rdunlap, neilb, LKML

On Mon, Jul 30, 2018 at 12:48:06PM -0700, Nick Desaulniers wrote:
> On Mon, Jul 30, 2018 at 11:39 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Mon, Jul 30, 2018 at 10:06:20AM -0700, Nick Desaulniers wrote:
> > > Starting with Clang-7.0, _THIS_IP_ generates -Wreturn-stack-address
> > > warnings for almost every translation unit. In general, I'd prefer to
> > > leave this on (returning the address of a stack allocated variable is in
> > > general a bad idea) and disable it only at whitelisted call sites.
> > >
> > > We can't do something like:
> > >  #pragma clang diagnostic push
> > >  #pragma clang diagnostic ignored "-Wreturn-stack-address"
> > >  <code>
> > >  #pragma clang diagnostic pop
> > >
> > > in a GNU Statement Expression or macro, hence we use _Pragma, which is
> > > its raison d'être: https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
> > >
> > > Cc: stable@vger.kernel.org # 4.17, 4.14, 4.9, 4.4
> > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > > ---
> > >  include/linux/kernel.h | 10 +++++++++-
> > >  1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > > index 941dc0a5a877..5906f5727f90 100644
> > > --- a/include/linux/kernel.h
> > > +++ b/include/linux/kernel.h
> > > @@ -168,7 +168,15 @@
> > >
> > >
> > >  #define _RET_IP_             (unsigned long)__builtin_return_address(0)
> > > -#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
> > > +#define _THIS_IP_  (                                                 \
> > > +{                                                                    \
> > > +     _Pragma("clang diagnostic push")                                \
> > > +     _Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"")  \
> > > +     __label__ __here;                                               \
> > > +__here: (unsigned long)&&__here;                                     \
> > > +     _Pragma("clang diagnostic pop")                                 \
> > > +}                                                                    \
> > > +)
> > >
> > >  #ifdef CONFIG_LBDAF
> > >  # include <asm/div64.h>
> > > --
> > > 2.18.0.233.g985f88cf7e-goog
> > >
> >
> > This generates a ton of warnings with GCC:
> >
> > In file included from ./include/linux/spinlock.h:58,
> >                  from ./include/linux/mmzone.h:8,
> >                  from ./include/linux/gfp.h:6,
> >                  from ./include/linux/slab.h:15,
> >                  from ./include/linux/crypto.h:24,
> >                  from arch/x86/kernel/asm-offsets.c:9:
> > ./include/linux/bottom_half.h: In function ‘local_bh_disable’:
> > ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> >   __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
> >
> > ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > ./include/linux/bottom_half.h: In function ‘local_bh_enable’:
> > ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> >   __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
> >
> > ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > cc1: all warnings being treated as errors
> > make[1]: *** [Kbuild:56: arch/x86/kernel/asm-offsets.s] Error 1
> > make: *** [Makefile:1081: prepare0] Error 2
> 
> Ah, good catch.  I thought I had tested locally with gcc-8, but it
> seems that it was likely only godbolt.  I do see the errors locally
> when building with gcc-8.
> 
> >
> > A proper solution is probably going to involve what was done for the
> > -Wattribute-alias warnings from GCC 8 in commits 8793bb7f4a9d ("kbuild:
> > add macro for controlling warnings to linux/compiler.h") and
> > bee20031772a ("disable -Wattribute-alias warning for SYSCALL_DEFINEx()")
> >
> > I'll take a look at it in a bit unless someone beats me to it.
> 
> I'll fix this up, triple check with gcc-8, and attribute you in the
> Suggested-by tag.  Thank you for verifying.
> -- 
> Thanks,
> ~Nick Desaulniers

I forgot to mention there is a similar macro that will need this same
fix in arch/arm64/include/asm/processor.h (current_text_addr), if you
want to tackle it in v2. Do CC me on the next series so that I can test,
thank you for doing this!

Cheers,
Nathan

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

* Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
  2018-07-30 20:01     ` Nathan Chancellor
@ 2018-07-30 21:15       ` Nick Desaulniers
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Desaulniers @ 2018-07-30 21:15 UTC (permalink / raw)
  To: natechancellor
  Cc: Andrew Morton, Matthias Kaehlcke, ghackmann, Greg Hackmann,
	stable, Kees Cook, Ingo Molnar, Greg KH, Josh Poimboeuf,
	Wei Wang, Masahiro Yamada, rdunlap, neilb, LKML

On Mon, Jul 30, 2018 at 1:01 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Mon, Jul 30, 2018 at 12:48:06PM -0700, Nick Desaulniers wrote:
> > On Mon, Jul 30, 2018 at 11:39 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > On Mon, Jul 30, 2018 at 10:06:20AM -0700, Nick Desaulniers wrote:
> > > > Starting with Clang-7.0, _THIS_IP_ generates -Wreturn-stack-address
> > > > warnings for almost every translation unit. In general, I'd prefer to
> > > > leave this on (returning the address of a stack allocated variable is in
> > > > general a bad idea) and disable it only at whitelisted call sites.
> > > >
> > > > We can't do something like:
> > > >  #pragma clang diagnostic push
> > > >  #pragma clang diagnostic ignored "-Wreturn-stack-address"
> > > >  <code>
> > > >  #pragma clang diagnostic pop
> > > >
> > > > in a GNU Statement Expression or macro, hence we use _Pragma, which is
> > > > its raison d'être: https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
> > > >
> > > > Cc: stable@vger.kernel.org # 4.17, 4.14, 4.9, 4.4
> > > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > > > ---
> > > >  include/linux/kernel.h | 10 +++++++++-
> > > >  1 file changed, 9 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > > > index 941dc0a5a877..5906f5727f90 100644
> > > > --- a/include/linux/kernel.h
> > > > +++ b/include/linux/kernel.h
> > > > @@ -168,7 +168,15 @@
> > > >
> > > >
> > > >  #define _RET_IP_             (unsigned long)__builtin_return_address(0)
> > > > -#define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
> > > > +#define _THIS_IP_  (                                                 \
> > > > +{                                                                    \
> > > > +     _Pragma("clang diagnostic push")                                \
> > > > +     _Pragma("clang diagnostic ignored \"-Wreturn-stack-address\"")  \
> > > > +     __label__ __here;                                               \
> > > > +__here: (unsigned long)&&__here;                                     \
> > > > +     _Pragma("clang diagnostic pop")                                 \
> > > > +}                                                                    \
> > > > +)
> > > >
> > > >  #ifdef CONFIG_LBDAF
> > > >  # include <asm/div64.h>
> > > > --
> > > > 2.18.0.233.g985f88cf7e-goog
> > > >
> > >
> > > This generates a ton of warnings with GCC:
> > >
> > > In file included from ./include/linux/spinlock.h:58,
> > >                  from ./include/linux/mmzone.h:8,
> > >                  from ./include/linux/gfp.h:6,
> > >                  from ./include/linux/slab.h:15,
> > >                  from ./include/linux/crypto.h:24,
> > >                  from arch/x86/kernel/asm-offsets.c:9:
> > > ./include/linux/bottom_half.h: In function ‘local_bh_disable’:
> > > ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > >   __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
> > >
> > > ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > > ./include/linux/bottom_half.h:19: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > > ./include/linux/bottom_half.h: In function ‘local_bh_enable’:
> > > ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > >   __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
> > >
> > > ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > > ./include/linux/bottom_half.h:32: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
> > > cc1: all warnings being treated as errors
> > > make[1]: *** [Kbuild:56: arch/x86/kernel/asm-offsets.s] Error 1
> > > make: *** [Makefile:1081: prepare0] Error 2
> >
> > Ah, good catch.  I thought I had tested locally with gcc-8, but it
> > seems that it was likely only godbolt.  I do see the errors locally
> > when building with gcc-8.
> >
> > >
> > > A proper solution is probably going to involve what was done for the
> > > -Wattribute-alias warnings from GCC 8 in commits 8793bb7f4a9d ("kbuild:
> > > add macro for controlling warnings to linux/compiler.h") and
> > > bee20031772a ("disable -Wattribute-alias warning for SYSCALL_DEFINEx()")
> > >
> > > I'll take a look at it in a bit unless someone beats me to it.
> >
> > I'll fix this up, triple check with gcc-8, and attribute you in the
> > Suggested-by tag.  Thank you for verifying.
> > --
> > Thanks,
> > ~Nick Desaulniers
>
> I forgot to mention there is a similar macro that will need this same
> fix in arch/arm64/include/asm/processor.h (current_text_addr), if you
> want to tackle it in v2. Do CC me on the next series so that I can test,
> thank you for doing this!

!!!

$ grep -R current_text_addr

shows many definitions of current_text_addr per arch/ that are all
essentially the same, and very very few uses of it.  I prefer to
consolidate current_text_addr() in a follow up series, since a common
definition with per-arch overrides will have to get a lot of sign
offs.

Though, for arm64, a simple:
-#define current_text_addr() ({ __label__ _l; _l: &&_l;})
+#define current_text_addr() _THIS_IP_

does the trick, it would be better to have a single shared definition.

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
  2018-07-30 17:06 [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_ Nick Desaulniers
  2018-07-30 18:39 ` Nathan Chancellor
@ 2018-07-31  6:50 ` kbuild test robot
  2018-07-31 16:46   ` Nick Desaulniers
  1 sibling, 1 reply; 7+ messages in thread
From: kbuild test robot @ 2018-07-31  6:50 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: kbuild-all, akpm, mka, ghackmann, ghackmann, Nick Desaulniers,
	stable, Kees Cook, Ingo Molnar, Greg Kroah-Hartman,
	Josh Poimboeuf, Wei Wang, Masahiro Yamada, Randy Dunlap,
	NeilBrown, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 17727 bytes --]

Hi Nick,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.18-rc7 next-20180727]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nick-Desaulniers/kernel-h-Disable-Wreturn-stack-address-for-_THIS_IP_/20180731-135818
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/spinlock.h:58:0,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/slab.h:15,
                    from include/linux/crypto.h:24,
                    from arch/x86/kernel/asm-offsets.c:9:
   include/linux/bottom_half.h: In function 'local_bh_disable':
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h: In function 'local_bh_enable':
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   In file included from include/linux/mmzone.h:8:0,
                    from include/linux/gfp.h:6,
                    from include/linux/slab.h:15,
                    from include/linux/crypto.h:24,
                    from arch/x86/kernel/asm-offsets.c:9:
   include/linux/spinlock.h: In function 'spin_lock_bh':
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_lock_bh(&lock->rlock);
    
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_unlock_bh':
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_unlock_bh(&lock->rlock);
    
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_trylock_bh':
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     return raw_spin_trylock_bh(&lock->rlock);
    
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
--
   In file included from include/linux/rcupdate.h:41:0,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from kernel//sched/sched.h:5,
                    from kernel//sched/core.c:8:
   include/linux/bottom_half.h: In function 'local_bh_disable':
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h: In function 'local_bh_enable':
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   In file included from include/linux/seqlock.h:36:0,
                    from include/linux/time.h:6,
                    from include/linux/ktime.h:24,
                    from include/linux/rcutiny.h:28,
                    from include/linux/rcupdate.h:210,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from kernel//sched/sched.h:5,
                    from kernel//sched/core.c:8:
   include/linux/spinlock.h: In function 'spin_lock_bh':
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_lock_bh(&lock->rlock);
    
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_unlock_bh':
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_unlock_bh(&lock->rlock);
    
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_trylock_bh':
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     return raw_spin_trylock_bh(&lock->rlock);
    
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel//sched/core.c: In function 'prepare_lock_switch':
>> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
    
>> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel//sched/core.c: In function 'finish_lock_switch':
   kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
    
   kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
--
   In file included from include/linux/spinlock.h:58:0,
                    from include/linux/irq.h:14,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from include/linux/kernel_stat.h:9,
                    from kernel//time/timer.c:22:
   include/linux/bottom_half.h: In function 'local_bh_disable':
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h: In function 'local_bh_enable':
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   In file included from include/linux/irq.h:14:0,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from include/linux/kernel_stat.h:9,
                    from kernel//time/timer.c:22:
   include/linux/spinlock.h: In function 'spin_lock_bh':
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_lock_bh(&lock->rlock);
    
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_unlock_bh':
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_unlock_bh(&lock->rlock);
    
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_trylock_bh':
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     return raw_spin_trylock_bh(&lock->rlock);
    
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel//time/timer.c: In function 'call_timer_fn':
>> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     lock_map_acquire(&lockdep_map);
    
>> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
--
   In file included from include/linux/rcupdate.h:41:0,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from kernel///sched/sched.h:5,
                    from kernel///sched/core.c:8:
   include/linux/bottom_half.h: In function 'local_bh_disable':
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h: In function 'local_bh_enable':
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   In file included from include/linux/seqlock.h:36:0,
                    from include/linux/time.h:6,
                    from include/linux/ktime.h:24,
                    from include/linux/rcutiny.h:28,
                    from include/linux/rcupdate.h:210,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from kernel///sched/sched.h:5,
                    from kernel///sched/core.c:8:
   include/linux/spinlock.h: In function 'spin_lock_bh':
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_lock_bh(&lock->rlock);
    
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_unlock_bh':
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_unlock_bh(&lock->rlock);
    
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_trylock_bh':
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     return raw_spin_trylock_bh(&lock->rlock);
    
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel///sched/core.c: In function 'prepare_lock_switch':
   kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
    
   kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel///sched/core.c: In function 'finish_lock_switch':
   kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
    
   kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
--
   In file included from include/linux/spinlock.h:58:0,
                    from include/linux/irq.h:14,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from include/linux/kernel_stat.h:9,
                    from kernel///time/timer.c:22:
   include/linux/bottom_half.h: In function 'local_bh_disable':
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h: In function 'local_bh_enable':
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
    
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   In file included from include/linux/irq.h:14:0,
                    from arch/x86/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from include/linux/kernel_stat.h:9,
                    from kernel///time/timer.c:22:
   include/linux/spinlock.h: In function 'spin_lock_bh':
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_lock_bh(&lock->rlock);
    
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_unlock_bh':
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     raw_spin_unlock_bh(&lock->rlock);
    
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h: In function 'spin_trylock_bh':
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     return raw_spin_trylock_bh(&lock->rlock);
    
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel///time/timer.c: In function 'call_timer_fn':
   kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
     lock_map_acquire(&lockdep_map);
    
   kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]

vim +19 include/linux/bottom_half.h

0bd3a173 Peter Zijlstra 2013-11-19  16  
0bd3a173 Peter Zijlstra 2013-11-19  17  static inline void local_bh_disable(void)
0bd3a173 Peter Zijlstra 2013-11-19  18  {
0bd3a173 Peter Zijlstra 2013-11-19 @19  	__local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
0bd3a173 Peter Zijlstra 2013-11-19  20  }
0bd3a173 Peter Zijlstra 2013-11-19  21  

:::::: The code at line 19 was first introduced by commit
:::::: 0bd3a173d711857fc9f583eb5825386cc08f3948 sched/preempt, locking: Rework local_bh_{dis,en}able()

:::::: TO: Peter Zijlstra <peterz@infradead.org>
:::::: CC: Ingo Molnar <mingo@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6368 bytes --]

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

* Re: [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_
  2018-07-31  6:50 ` kbuild test robot
@ 2018-07-31 16:46   ` Nick Desaulniers
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Desaulniers @ 2018-07-31 16:46 UTC (permalink / raw)
  To: lkp
  Cc: kbuild-all, Andrew Morton, Matthias Kaehlcke, ghackmann,
	Greg Hackmann, stable, Kees Cook, Ingo Molnar, Greg KH,
	Josh Poimboeuf, Wei Wang, Masahiro Yamada, rdunlap, neilb, LKML,
	Nathan Chancellor

I think this is the v1 of this patch, also reported by Nathan
Chancellor? Hard to tell as the github link is dead.  Does 0-day
delete its branches if there's a v2?
On Mon, Jul 30, 2018 at 11:50 PM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Nick,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.18-rc7 next-20180727]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Nick-Desaulniers/kernel-h-Disable-Wreturn-stack-address-for-_THIS_IP_/20180731-135818
> config: i386-tinyconfig (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> All warnings (new ones prefixed by >>):
>
>    In file included from include/linux/spinlock.h:58:0,
>                     from include/linux/mmzone.h:8,
>                     from include/linux/gfp.h:6,
>                     from include/linux/slab.h:15,
>                     from include/linux/crypto.h:24,
>                     from arch/x86/kernel/asm-offsets.c:9:
>    include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h: In function 'local_bh_enable':
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    In file included from include/linux/mmzone.h:8:0,
>                     from include/linux/gfp.h:6,
>                     from include/linux/slab.h:15,
>                     from include/linux/crypto.h:24,
>                     from arch/x86/kernel/asm-offsets.c:9:
>    include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_unlock_bh':
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_unlock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_trylock_bh':
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      return raw_spin_trylock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
>    In file included from include/linux/rcupdate.h:41:0,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from kernel//sched/sched.h:5,
>                     from kernel//sched/core.c:8:
>    include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h: In function 'local_bh_enable':
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    In file included from include/linux/seqlock.h:36:0,
>                     from include/linux/time.h:6,
>                     from include/linux/ktime.h:24,
>                     from include/linux/rcutiny.h:28,
>                     from include/linux/rcupdate.h:210,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from kernel//sched/sched.h:5,
>                     from kernel//sched/core.c:8:
>    include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_unlock_bh':
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_unlock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_trylock_bh':
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      return raw_spin_trylock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel//sched/core.c: In function 'prepare_lock_switch':
> >> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
>
> >> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> kernel//sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel//sched/core.c: In function 'finish_lock_switch':
>    kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
>
>    kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel//sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
>    In file included from include/linux/spinlock.h:58:0,
>                     from include/linux/irq.h:14,
>                     from arch/x86/include/asm/hardirq.h:6,
>                     from include/linux/hardirq.h:9,
>                     from include/linux/interrupt.h:11,
>                     from include/linux/kernel_stat.h:9,
>                     from kernel//time/timer.c:22:
>    include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h: In function 'local_bh_enable':
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    In file included from include/linux/irq.h:14:0,
>                     from arch/x86/include/asm/hardirq.h:6,
>                     from include/linux/hardirq.h:9,
>                     from include/linux/interrupt.h:11,
>                     from include/linux/kernel_stat.h:9,
>                     from kernel//time/timer.c:22:
>    include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_unlock_bh':
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_unlock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_trylock_bh':
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      return raw_spin_trylock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel//time/timer.c: In function 'call_timer_fn':
> >> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      lock_map_acquire(&lockdep_map);
>
> >> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> kernel//time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
>    In file included from include/linux/rcupdate.h:41:0,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from kernel///sched/sched.h:5,
>                     from kernel///sched/core.c:8:
>    include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h: In function 'local_bh_enable':
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    In file included from include/linux/seqlock.h:36:0,
>                     from include/linux/time.h:6,
>                     from include/linux/ktime.h:24,
>                     from include/linux/rcutiny.h:28,
>                     from include/linux/rcupdate.h:210,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from kernel///sched/sched.h:5,
>                     from kernel///sched/core.c:8:
>    include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_unlock_bh':
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_unlock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_trylock_bh':
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      return raw_spin_trylock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel///sched/core.c: In function 'prepare_lock_switch':
>    kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
>
>    kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel///sched/core.c:2590:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel///sched/core.c: In function 'finish_lock_switch':
>    kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
>
>    kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel///sched/core.c:2604:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> --
>    In file included from include/linux/spinlock.h:58:0,
>                     from include/linux/irq.h:14,
>                     from arch/x86/include/asm/hardirq.h:6,
>                     from include/linux/hardirq.h:9,
>                     from include/linux/interrupt.h:11,
>                     from include/linux/kernel_stat.h:9,
>                     from kernel///time/timer.c:22:
>    include/linux/bottom_half.h: In function 'local_bh_disable':
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/bottom_half.h:19:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h: In function 'local_bh_enable':
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
>
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/bottom_half.h:32:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    In file included from include/linux/irq.h:14:0,
>                     from arch/x86/include/asm/hardirq.h:6,
>                     from include/linux/hardirq.h:9,
>                     from include/linux/interrupt.h:11,
>                     from include/linux/kernel_stat.h:9,
>                     from kernel///time/timer.c:22:
>    include/linux/spinlock.h: In function 'spin_lock_bh':
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_lock_bh(&lock->rlock);
>
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
> >> include/linux/spinlock.h:315:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_unlock_bh':
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      raw_spin_unlock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:355:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h: In function 'spin_trylock_bh':
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      return raw_spin_trylock_bh(&lock->rlock);
>
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    include/linux/spinlock.h:370:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel///time/timer.c: In function 'call_timer_fn':
>    kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>      lock_map_acquire(&lockdep_map);
>
>    kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>    kernel///time/timer.c:1323:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
>
> vim +19 include/linux/bottom_half.h
>
> 0bd3a173 Peter Zijlstra 2013-11-19  16
> 0bd3a173 Peter Zijlstra 2013-11-19  17  static inline void local_bh_disable(void)
> 0bd3a173 Peter Zijlstra 2013-11-19  18  {
> 0bd3a173 Peter Zijlstra 2013-11-19 @19          __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
> 0bd3a173 Peter Zijlstra 2013-11-19  20  }
> 0bd3a173 Peter Zijlstra 2013-11-19  21
>
> :::::: The code at line 19 was first introduced by commit
> :::::: 0bd3a173d711857fc9f583eb5825386cc08f3948 sched/preempt, locking: Rework local_bh_{dis,en}able()
>
> :::::: TO: Peter Zijlstra <peterz@infradead.org>
> :::::: CC: Ingo Molnar <mingo@kernel.org>
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



-- 
Thanks,
~Nick Desaulniers

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

end of thread, other threads:[~2018-07-31 16:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 17:06 [PATCH] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_ Nick Desaulniers
2018-07-30 18:39 ` Nathan Chancellor
2018-07-30 19:48   ` Nick Desaulniers
2018-07-30 20:01     ` Nathan Chancellor
2018-07-30 21:15       ` Nick Desaulniers
2018-07-31  6:50 ` kbuild test robot
2018-07-31 16:46   ` Nick Desaulniers

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.