latent_entropy: avoid build error when plugin cflags are not set
PATCH 1/1 latent_entropy: avoid build error when plugin cflags are not set
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.
--- include/linux/random.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/random.h +1 -1
@@ -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,
Signature · 1 line
2.18.0.13.gd42ae10
Quoted 23 lines · Vasily Gorbik
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 includinglinux/random.hin 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 inThe build error is triggered by commit
a80313ff91ab("s390/kernel:
introduce .dma sections") which made it into 5.2 merge window.
Quoted 7 lines
To address that avoid using
CONFIG_GCC_PLUGIN_LATENT_ENTROPYin favour ofLATENT_ENTROPY_PLUGINdefinition 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 inlinux/compiler-gcc.hforlatent_entropyattribute definition.Signed-off-by Vasily Gorbik <[email protected]>
Thanks for fixing this! Do you want to take it via the s390 tree?
-Kees
Quoted 20 lines
--- include/linux/random.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/random.h +1
-2@@ -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
Signature · 1 line
Kees Cook
Quoted 30 lines · On Tue, 7 May 2019 09:16:29 -0700 Kees Cook <[email protected]> wrote:
Quoted 29 lines · Vasily Gorbik
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 includinglinux/random.hin 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 inThe 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_ENTROPYin favour ofLATENT_ENTROPY_PLUGINdefinition 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 inlinux/compiler-gcc.hforlatent_entropyattribute definition.
Quoted 5 lines
Quoted 1 line
Signed-off-by Vasily Gorbik <[email protected]>Thanks for fixing this! Do you want to take it via the s390 tree?
Acked-by Kees Cook <[email protected]>
Sure, I can take it via the s390 tree.
Quoted 22 lines
Quoted 20 lines
--- include/linux/random.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/random.h +1
-2@@ -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
Signature · 4 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin.