mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] latent_entropy: avoid build error when plugin cflags are not set
@ 2019-05-07 14:28 Vasily Gorbik
  2019-05-07 16:16 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Vasily Gorbik @ 2019-05-07 14:28 UTC (permalink / raw)
  To: Kees Cook, Andrew Morton
  Cc: Emese Revfy, Heiko Carstens, Martin Schwidefsky, linux-kernel

Some architectures set up CFLAGS for linux decompressor phase from
scratch and do not include GCC_PLUGINS_CFLAGS. Since "latent_entropy"
variable declaration is generated by the plugin code itself including
linux/random.h in decompressor code then would cause a build
error. E.g. on s390:

In file included from ./include/linux/net.h:22,
                 from ./include/linux/skbuff.h:29,
                 from ./include/linux/if_ether.h:23,
                 from ./arch/s390/include/asm/diag.h:12,
                 from arch/s390/boot/startup.c:8:
./include/linux/random.h: In function 'add_latent_entropy':
./include/linux/random.h:26:39: error: 'latent_entropy' undeclared
(first use in this function); did you mean 'add_latent_entropy'?
   26 |  add_device_randomness((const void *)&latent_entropy,
      |                                       ^~~~~~~~~~~~~~
      |                                       add_latent_entropy
./include/linux/random.h:26:39: note: each undeclared identifier is
reported only once for each function it appears in

The build error is triggered by commit a80313ff91ab ("s390/kernel:
introduce .dma sections") which made it into 5.2 merge window.

To address that avoid using CONFIG_GCC_PLUGIN_LATENT_ENTROPY in
favour of LATENT_ENTROPY_PLUGIN definition which is defined as a
part of gcc plugins cflags and hence reflect more accurately when gcc
plugin is active. Besides that it is also used for similar purpose in
linux/compiler-gcc.h for latent_entropy attribute definition.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
 include/linux/random.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/random.h b/include/linux/random.h
index 445a0ea4ff49..d4eb9b3789ad 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -20,7 +20,7 @@ struct random_ready_callback {
 
 extern void add_device_randomness(const void *, unsigned int);
 
-#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__)
+#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
 static inline void add_latent_entropy(void)
 {
 	add_device_randomness((const void *)&latent_entropy,
-- 
2.18.0.13.gd42ae10


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

* Re: [PATCH] latent_entropy: avoid build error when plugin cflags are not set
  2019-05-07 14:28 [PATCH] latent_entropy: avoid build error when plugin cflags are not set Vasily Gorbik
@ 2019-05-07 16:16 ` Kees Cook
  2019-05-08  6:14   ` Martin Schwidefsky
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2019-05-07 16:16 UTC (permalink / raw)
  To: Vasily Gorbik
  Cc: Andrew Morton, Emese Revfy, Heiko Carstens, Martin Schwidefsky, LKML

On Tue, May 7, 2019 at 7:28 AM Vasily Gorbik <gor@linux.ibm.com> wrote:
> Some architectures set up CFLAGS for linux decompressor phase from
> scratch and do not include GCC_PLUGINS_CFLAGS. Since "latent_entropy"
> variable declaration is generated by the plugin code itself including
> linux/random.h in decompressor code then would cause a build
> error. E.g. on s390:
>
> In file included from ./include/linux/net.h:22,
>                  from ./include/linux/skbuff.h:29,
>                  from ./include/linux/if_ether.h:23,
>                  from ./arch/s390/include/asm/diag.h:12,
>                  from arch/s390/boot/startup.c:8:
> ./include/linux/random.h: In function 'add_latent_entropy':
> ./include/linux/random.h:26:39: error: 'latent_entropy' undeclared
> (first use in this function); did you mean 'add_latent_entropy'?
>    26 |  add_device_randomness((const void *)&latent_entropy,
>       |                                       ^~~~~~~~~~~~~~
>       |                                       add_latent_entropy
> ./include/linux/random.h:26:39: note: each undeclared identifier is
> reported only once for each function it appears in
>
> The build error is triggered by commit a80313ff91ab ("s390/kernel:
> introduce .dma sections") which made it into 5.2 merge window.
>
> To address that avoid using CONFIG_GCC_PLUGIN_LATENT_ENTROPY in
> favour of LATENT_ENTROPY_PLUGIN definition which is defined as a
> part of gcc plugins cflags and hence reflect more accurately when gcc
> plugin is active. Besides that it is also used for similar purpose in
> linux/compiler-gcc.h for latent_entropy attribute definition.
>
> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

Thanks for fixing this! Do you want to take it via the s390 tree?

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  include/linux/random.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/random.h b/include/linux/random.h
> index 445a0ea4ff49..d4eb9b3789ad 100644
> --- a/include/linux/random.h
> +++ b/include/linux/random.h
> @@ -20,7 +20,7 @@ struct random_ready_callback {
>
>  extern void add_device_randomness(const void *, unsigned int);
>
> -#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__)
> +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
>  static inline void add_latent_entropy(void)
>  {
>         add_device_randomness((const void *)&latent_entropy,
> --
> 2.18.0.13.gd42ae10
>


-- 
Kees Cook

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

* Re: [PATCH] latent_entropy: avoid build error when plugin cflags are not set
  2019-05-07 16:16 ` Kees Cook
@ 2019-05-08  6:14   ` Martin Schwidefsky
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Schwidefsky @ 2019-05-08  6:14 UTC (permalink / raw)
  To: Kees Cook; +Cc: Vasily Gorbik, Andrew Morton, Emese Revfy, Heiko Carstens, LKML

On Tue, 7 May 2019 09:16:29 -0700
Kees Cook <keescook@chromium.org> wrote:

> On Tue, May 7, 2019 at 7:28 AM Vasily Gorbik <gor@linux.ibm.com> wrote:
> > Some architectures set up CFLAGS for linux decompressor phase from
> > scratch and do not include GCC_PLUGINS_CFLAGS. Since "latent_entropy"
> > variable declaration is generated by the plugin code itself including
> > linux/random.h in decompressor code then would cause a build
> > error. E.g. on s390:
> >
> > In file included from ./include/linux/net.h:22,
> >                  from ./include/linux/skbuff.h:29,
> >                  from ./include/linux/if_ether.h:23,
> >                  from ./arch/s390/include/asm/diag.h:12,
> >                  from arch/s390/boot/startup.c:8:
> > ./include/linux/random.h: In function 'add_latent_entropy':
> > ./include/linux/random.h:26:39: error: 'latent_entropy' undeclared
> > (first use in this function); did you mean 'add_latent_entropy'?
> >    26 |  add_device_randomness((const void *)&latent_entropy,
> >       |                                       ^~~~~~~~~~~~~~
> >       |                                       add_latent_entropy
> > ./include/linux/random.h:26:39: note: each undeclared identifier is
> > reported only once for each function it appears in
> >
> > The build error is triggered by commit a80313ff91ab ("s390/kernel:
> > introduce .dma sections") which made it into 5.2 merge window.
> >
> > To address that avoid using CONFIG_GCC_PLUGIN_LATENT_ENTROPY in
> > favour of LATENT_ENTROPY_PLUGIN definition which is defined as a
> > part of gcc plugins cflags and hence reflect more accurately when gcc
> > plugin is active. Besides that it is also used for similar purpose in
> > linux/compiler-gcc.h for latent_entropy attribute definition.
> >
> > Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>  
> 
> Thanks for fixing this! Do you want to take it via the s390 tree?
> 
> Acked-by: Kees Cook <keescook@chromium.org>

Sure, I can take it via the s390 tree.
 
> > ---
> >  include/linux/random.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/random.h b/include/linux/random.h
> > index 445a0ea4ff49..d4eb9b3789ad 100644
> > --- a/include/linux/random.h
> > +++ b/include/linux/random.h
> > @@ -20,7 +20,7 @@ struct random_ready_callback {
> >
> >  extern void add_device_randomness(const void *, unsigned int);
> >
> > -#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__)
> > +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
> >  static inline void add_latent_entropy(void)
> >  {
> >         add_device_randomness((const void *)&latent_entropy,
> > --
> > 2.18.0.13.gd42ae10
> >  
> 
> 


-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


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

end of thread, other threads:[~2019-05-08  6:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 14:28 [PATCH] latent_entropy: avoid build error when plugin cflags are not set Vasily Gorbik
2019-05-07 16:16 ` Kees Cook
2019-05-08  6:14   ` Martin Schwidefsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®