Lee Duncan 66e3ba
From: Vasily Gorbik <gor@linux.ibm.com>
Lee Duncan 66e3ba
Date: Tue, 7 May 2019 16:28:15 +0200
Lee Duncan 66e3ba
Subject: latent_entropy: avoid build error when plugin cflags are not set
Lee Duncan 66e3ba
Git-commit: 7e756f423af808b6571fed3144747db2ef7fa1c5
Lee Duncan 66e3ba
Patch-mainline: v5.2-rc1
Lee Duncan 66e3ba
References: git-fixes
Lee Duncan 66e3ba
Lee Duncan 66e3ba
Some architectures set up CFLAGS for linux decompressor phase from
Lee Duncan 66e3ba
scratch and do not include GCC_PLUGINS_CFLAGS. Since "latent_entropy"
Lee Duncan 66e3ba
variable declaration is generated by the plugin code itself including
Lee Duncan 66e3ba
linux/random.h in decompressor code then would cause a build
Lee Duncan 66e3ba
error. E.g. on s390:
Lee Duncan 66e3ba
Lee Duncan 66e3ba
In file included from ./include/linux/net.h:22,
Lee Duncan 66e3ba
                 from ./include/linux/skbuff.h:29,
Lee Duncan 66e3ba
                 from ./include/linux/if_ether.h:23,
Lee Duncan 66e3ba
                 from ./arch/s390/include/asm/diag.h:12,
Lee Duncan 66e3ba
                 from arch/s390/boot/startup.c:8:
Lee Duncan 66e3ba
./include/linux/random.h: In function 'add_latent_entropy':
Lee Duncan 66e3ba
./include/linux/random.h:26:39: error: 'latent_entropy' undeclared
Lee Duncan 66e3ba
(first use in this function); did you mean 'add_latent_entropy'?
Lee Duncan 66e3ba
   26 |  add_device_randomness((const void *)&latent_entropy,
Lee Duncan 66e3ba
      |                                       ^~~~~~~~~~~~~~
Lee Duncan 66e3ba
      |                                       add_latent_entropy
Lee Duncan 66e3ba
./include/linux/random.h:26:39: note: each undeclared identifier is
Lee Duncan 66e3ba
reported only once for each function it appears in
Lee Duncan 66e3ba
Lee Duncan 66e3ba
The build error is triggered by commit a80313ff91ab ("s390/kernel:
Lee Duncan 66e3ba
introduce .dma sections") which made it into 5.2 merge window.
Lee Duncan 66e3ba
Lee Duncan 66e3ba
To address that avoid using CONFIG_GCC_PLUGIN_LATENT_ENTROPY in
Lee Duncan 66e3ba
favour of LATENT_ENTROPY_PLUGIN definition which is defined as a
Lee Duncan 66e3ba
part of gcc plugins cflags and hence reflect more accurately when gcc
Lee Duncan 66e3ba
plugin is active. Besides that it is also used for similar purpose in
Lee Duncan 66e3ba
linux/compiler-gcc.h for latent_entropy attribute definition.
Lee Duncan 66e3ba
Lee Duncan 66e3ba
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Lee Duncan 66e3ba
Acked-by: Kees Cook <keescook@chromium.org>
Lee Duncan 66e3ba
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Lee Duncan 66e3ba
Acked-by: Lee Duncan <lduncan@suse.com>
Lee Duncan 66e3ba
---
Lee Duncan 66e3ba
 include/linux/random.h | 2 +-
Lee Duncan 66e3ba
 1 file changed, 1 insertion(+), 1 deletion(-)
Lee Duncan 66e3ba
Lee Duncan 66e3ba
diff --git a/include/linux/random.h b/include/linux/random.h
Lee Duncan 66e3ba
index 445a0ea4ff49..d4eb9b3789ad 100644
Lee Duncan 66e3ba
--- a/include/linux/random.h
Lee Duncan 66e3ba
+++ b/include/linux/random.h
Lee Duncan 66e3ba
@@ -20,7 +20,7 @@ struct random_ready_callback {
Lee Duncan 66e3ba
 
Lee Duncan 66e3ba
 extern void add_device_randomness(const void *, unsigned int);
Lee Duncan 66e3ba
 
Lee Duncan 66e3ba
-#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__)
Lee Duncan 66e3ba
+#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
Lee Duncan 66e3ba
 static inline void add_latent_entropy(void)
Lee Duncan 66e3ba
 {
Lee Duncan 66e3ba
 	add_device_randomness((const void *)&latent_entropy,
Lee Duncan 66e3ba