1
0
Fork 0
remarkable-linux/arch/x86
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
..
boot x86/boot: Fix if_changed build flip/flop bug 2018-09-05 09:26:29 +02:00
configs x86/unwind: Rename unwinder config options to 'CONFIG_UNWINDER_*' 2017-12-25 14:26:13 +01:00
crypto crypto: x86/sha256-mb - fix digest copy in sha256_mb_mgr_get_comp_job_avx2() 2018-08-17 21:01:10 +02:00
entry x86/entry/64: Remove %ebx handling from error_entry/exit 2018-08-06 16:20:49 +02:00
events perf/x86/amd/ibs: Don't access non-started event 2018-09-05 09:26:28 +02:00
hyperv x86/hyperv: Check for required priviliges in hyperv_init() 2018-04-26 11:02:13 +02:00
ia32 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
include x86/speculation/l1tf: Exempt zeroed PTEs from inversion 2018-08-18 10:48:00 +02:00
kernel kvmclock: fix TSC calibration for nested guests 2018-08-24 13:09:18 +02:00
kvm KVM: vmx: use local variable for current_vmptr when emulating VMPTRST 2018-09-05 09:26:27 +02:00
lib Revert "x86/retpoline: Simplify vmexit_fill_RSB()" 2018-03-15 10:54:36 +01:00
math-emu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mm x86/mm: Add TLB purge to free pmd/pte page interfaces 2018-08-17 21:01:11 +02:00
net bpf, x64: fix memleak when not converging after image 2018-06-21 04:02:52 +09:00
oprofile x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() 2018-02-28 10:19:41 +01:00
pci x86/PCI: Make broadcom_postcore_init() check acpi_disabled 2017-12-14 09:52:53 +01:00
platform x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d 2018-08-15 18:12:58 +02:00
power x86/power: Fix swsusp_arch_resume prototype 2018-04-26 11:02:16 +02:00
purgatory License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ras License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
realmode x86-64/realmode: Add instruction suffix 2018-03-15 10:54:36 +01:00
tools x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-03-19 08:42:44 +01:00
um um: Use POSIX ucontext_t instead of struct ucontext 2018-04-24 09:36:33 +02:00
video
xen x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-15 18:12:58 +02:00
.gitignore
Kbuild Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:25:15 -07:00
Kconfig cpu/hotplug: Provide knobs to control SMT 2018-08-15 18:12:52 +02:00
Kconfig.cpu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig.debug x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit 2017-12-25 14:26:14 +01:00
Makefile x86/build/64: Force the linker to use 2MB page size 2018-03-28 18:24:47 +02:00
Makefile.um License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile_32.cpu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00