1
0
Fork 0
remarkable-linux/arch
Kees Cook 165335d4f1 x86/boot: Fix if_changed build flip/flop bug
[ Upstream commit 92a4728608 ]

Dirk Gouders reported that two consecutive "make" invocations on an
already compiled tree will show alternating behaviors:

$ make
  CALL    scripts/checksyscalls.sh
  DESCEND  objtool
  CHK     include/generated/compile.h
  DATAREL arch/x86/boot/compressed/vmlinux
Kernel: arch/x86/boot/bzImage is ready  (#48)
  Building modules, stage 2.
  MODPOST 165 modules

$ make
  CALL    scripts/checksyscalls.sh
  DESCEND  objtool
  CHK     include/generated/compile.h
  LD      arch/x86/boot/compressed/vmlinux
  ZOFFSET arch/x86/boot/zoffset.h
  AS      arch/x86/boot/header.o
  LD      arch/x86/boot/setup.elf
  OBJCOPY arch/x86/boot/setup.bin
  OBJCOPY arch/x86/boot/vmlinux.bin
  BUILD   arch/x86/boot/bzImage
Setup is 15644 bytes (padded to 15872 bytes).
System is 6663 kB
CRC 3eb90f40
Kernel: arch/x86/boot/bzImage is ready  (#48)
  Building modules, stage 2.
  MODPOST 165 modules

He bisected it back to:

    commit 98f7852537 ("x86/boot: Refuse to build with data relocations")

The root cause was the use of the "if_changed" kbuild function multiple
times for the same target. It was designed to only be used once per
target, otherwise it will effectively always trigger, flipping back and
forth between the two commands getting recorded by "if_changed". Instead,
this patch merges the two commands into a single function to get stable
build artifacts (i.e. .vmlinux.cmd), and a single build behavior.

Bisected-and-Reported-by: Dirk Gouders <dirk@gouders.net>
Fix-Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180724230827.GA37823@beast
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-05 09:26:29 +02:00
..
alpha alpha: fix osf_wait4() breakage 2018-07-25 11:25:11 +02:00
arc ARC: Improve cmpxchg syscall implementation 2018-08-24 13:09:15 +02:00
arm ARM: dts: imx6: RDU2: fix irq type for mv88e6xxx switch 2018-08-24 13:09:20 +02:00
arm64 ARM64: dts: meson-gxl: fix Mali GPU compatible string 2018-08-24 13:09:08 +02:00
blackfin pinctrl: adi2: Fix Kconfig build problem 2017-12-20 10:10:34 +01:00
c6x License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
cris bug.h: work around GCC PR82365 in BUG() 2018-05-30 07:52:00 +02:00
frv License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
h8300 h8300: remove extraneous __BIG_ENDIAN definition 2018-03-28 18:24:38 +02:00
hexagon hexagon: export csum_partial_copy_nocheck 2018-06-21 04:02:52 +09:00
ia64 ia64/err-inject: Use get_user_pages_fast() 2018-05-30 07:52:11 +02:00
m32r m32r: fix endianness constraints 2018-02-28 10:19:44 +01:00
m68k m68k: fix "bad page state" oops on ColdFire boot 2018-08-24 13:09:11 +02:00
metag .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
microblaze microblaze: Fix simpleImage format generation 2018-08-03 07:50:40 +02:00
mips MIPS: Fix off-by-one in pci_resource_to_user() 2018-07-28 07:55:41 +02:00
mn10300 mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy 2018-02-16 20:23:11 +01:00
nios2 .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
openrisc openrisc: entry: Fix delay slot exception detection 2018-08-24 13:09:11 +02:00
parisc parisc: Remove unnecessary barriers from spinlock.h 2018-08-24 13:09:22 +02:00
powerpc bpf, ppc64: fix unexpected r0=0 exit path inside bpf_xadd 2018-09-05 09:26:27 +02:00
s390 bpf, s390: fix potential memleak when later bpf_jit_prog fails 2018-08-24 13:09:09 +02:00
score License cleanup: add SPDX license identifier to uapi header files with no license 2017-11-02 11:19:54 +01:00
sh sh: fix build failure for J2 cpu with SMP disabled 2018-06-21 04:02:54 +09:00
sparc sparc64: Make atomic_xchg() an inline function rather than a macro. 2018-05-30 07:52:25 +02:00
tile fcntl: don't cap l_start and l_end values for F_GETLK64 in compat syscall 2017-12-17 15:07:59 +01:00
um um: Use POSIX ucontext_t instead of struct ucontext 2018-04-24 09:36:33 +02:00
unicore32 kmemcheck: stop using GFP_NOTRACK and SLAB_NOTRACK 2018-02-22 15:42:23 +01:00
x86 x86/boot: Fix if_changed build flip/flop bug 2018-09-05 09:26:29 +02:00
xtensa signal/xtensa: Consistenly use SIGBUS in do_unaligned_user 2018-07-03 11:24:47 +02:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig cpu/hotplug: Provide knobs to control SMT 2018-08-15 18:12:52 +02:00