提交 53e063f8 编写于 作者: M Masahiro Yamada 提交者: Zheng Zengkai

powerpc/book3e: get rid of #include <generated/compile.h>

stable inclusion
from stable-v5.10.124
commit a3e50506ea0d39b352b0c2bad026d663d4400647
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6E7

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a3e50506ea0d39b352b0c2bad026d663d4400647

--------------------------------

commit 7ad4bd88 upstream.

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 f231e433 ("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: 6a38ea1d ("powerpc/fsl_booke/32: randomize the kernel image offset")
Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
Acked-by: NScott Wood <oss@buserror.net>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220604085050.4078927-1-masahiroy@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 b3eb01dd
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/kdump.h> #include <asm/kdump.h>
#include <mm/mmu_decl.h> #include <mm/mmu_decl.h>
#include <generated/compile.h>
#include <generated/utsrelease.h> #include <generated/utsrelease.h>
struct regions { struct regions {
...@@ -37,10 +36,6 @@ struct regions { ...@@ -37,10 +36,6 @@ struct regions {
int reserved_mem_size_cells; int reserved_mem_size_cells;
}; };
/* Simplified build-specific string for starting entropy. */
static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
struct regions __initdata regions; struct regions __initdata regions;
static __init void kaslr_get_cmdline(void *fdt) static __init void kaslr_get_cmdline(void *fdt)
...@@ -73,7 +68,8 @@ static unsigned long __init get_boot_seed(void *fdt) ...@@ -73,7 +68,8 @@ static unsigned long __init get_boot_seed(void *fdt)
{ {
unsigned long hash = 0; unsigned long hash = 0;
hash = rotate_xor(hash, build_str, sizeof(build_str)); /* build-specific string for starting entropy. */
hash = rotate_xor(hash, linux_banner, strlen(linux_banner));
hash = rotate_xor(hash, fdt, fdt_totalsize(fdt)); hash = rotate_xor(hash, fdt, fdt_totalsize(fdt));
return hash; return hash;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册