Skip to content

Commit 7ad4bd8

Browse files
masahir0ympe
authored andcommitted
powerpc/book3e: get rid of #include <generated/compile.h>
You cannot include <generated/compile.h> here because it is generated in init/Makefile but there is no guarantee that it happens before arch/powerpc/mm/nohash/kaslr_booke.c is compiled for parallel builds. The places where you can reliably include <generated/compile.h> are: - init/ (because init/Makefile can specify the dependency) - arch/*/boot/ (because it is compiled after vmlinux) Commit f231e43 ("hexagon: get rid of #include <generated/compile.h>") fixed the last breakage at that time, but powerpc re-added this. <generated/compile.h> was unneeded because 'build_str' is almost the same as 'linux_banner' defined in init/version.c Let's copy the solution from MIPS. (get_random_boot() in arch/mips/kernel/relocate.c) Fixes: 6a38ea1 ("powerpc/fsl_booke/32: randomize the kernel image offset") Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Scott Wood <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3e8635f commit 7ad4bd8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/powerpc/mm/nohash/kaslr_booke.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <asm/cacheflush.h>
2020
#include <asm/kdump.h>
2121
#include <mm/mmu_decl.h>
22-
#include <generated/compile.h>
2322
#include <generated/utsrelease.h>
2423

2524
struct regions {
@@ -37,10 +36,6 @@ struct regions {
3736
int reserved_mem_size_cells;
3837
};
3938

40-
/* Simplified build-specific string for starting entropy. */
41-
static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
42-
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
43-
4439
struct regions __initdata regions;
4540

4641
static __init void kaslr_get_cmdline(void *fdt)
@@ -71,7 +66,8 @@ static unsigned long __init get_boot_seed(void *fdt)
7166
{
7267
unsigned long hash = 0;
7368

74-
hash = rotate_xor(hash, build_str, sizeof(build_str));
69+
/* build-specific string for starting entropy. */
70+
hash = rotate_xor(hash, linux_banner, strlen(linux_banner));
7571
hash = rotate_xor(hash, fdt, fdt_totalsize(fdt));
7672

7773
return hash;

0 commit comments

Comments
 (0)