* [PATCH] x86/boot: Fix if_changed build flip/flop
@ 2018-07-15 2:56 Kees Cook
2018-07-15 22:58 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2018-07-15 2:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: Dirk Gouders, Masahiro Yamada, Thomas Gleixner, H. Peter Anvin,
x86, linux-kernel
The if_changed kbuild function can only be used once per target. If not
it will effectively always trigger, flipping back and forth between the
two commands getting recorded. Instead, merge the two commands into a
single function to get stable build artifacts (i.e. .vmlinux.cmd).
Reported-by: Dirk Gouders <dirk@gouders.net>
Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Fixes: 98f78525371b ("x86/boot: Refuse to build with data relocations")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
arch/x86/boot/compressed/Makefile | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index fa42f895fdde..169c2feda14a 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -106,9 +106,13 @@ define cmd_check_data_rel
done
endef
+# We need to run two commands under "if_changed", so merge them into a
+# single invocation.
+quiet_cmd_check-and-link-vmlinux = LD $@
+ cmd_check-and-link-vmlinux = $(cmd_check_data_rel); $(cmd_ld)
+
$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
- $(call if_changed,check_data_rel)
- $(call if_changed,ld)
+ $(call if_changed,check-and-link-vmlinux)
OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
$(obj)/vmlinux.bin: vmlinux FORCE
--
2.17.1
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/boot: Fix if_changed build flip/flop
2018-07-15 2:56 [PATCH] x86/boot: Fix if_changed build flip/flop Kees Cook
@ 2018-07-15 22:58 ` Ingo Molnar
2018-07-18 5:44 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2018-07-15 22:58 UTC (permalink / raw)
To: Kees Cook
Cc: Ingo Molnar, Dirk Gouders, Masahiro Yamada, Thomas Gleixner,
H. Peter Anvin, x86, linux-kernel
* Kees Cook <keescook@chromium.org> wrote:
> The if_changed kbuild function can only be used once per target. If not
> it will effectively always trigger, flipping back and forth between the
> two commands getting recorded. Instead, merge the two commands into a
> single function to get stable build artifacts (i.e. .vmlinux.cmd).
>
> Reported-by: Dirk Gouders <dirk@gouders.net>
What actual symptoms does this bug have?
I.e. it would be nice if the changelog started with such an explanation:
Dirk Gouders reported that .... <bad stuff happens during kernel build> ...
and bisected it back to:
98f78525371b ("x86/boot: Refuse to build with data relocations")
The root cause of the bug is that the if_changed kbuild function ...
Or something like that.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/boot: Fix if_changed build flip/flop
2018-07-15 22:58 ` Ingo Molnar
@ 2018-07-18 5:44 ` Masahiro Yamada
0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-07-18 5:44 UTC (permalink / raw)
To: Ingo Molnar
Cc: Kees Cook, Ingo Molnar, Dirk Gouders, Thomas Gleixner,
H. Peter Anvin, X86 ML, Linux Kernel Mailing List
2018-07-16 7:58 GMT+09:00 Ingo Molnar <mingo@kernel.org>:
>
> * Kees Cook <keescook@chromium.org> wrote:
>
>> The if_changed kbuild function can only be used once per target. If not
>> it will effectively always trigger, flipping back and forth between the
>> two commands getting recorded. Instead, merge the two commands into a
>> single function to get stable build artifacts (i.e. .vmlinux.cmd).
>>
>> Reported-by: Dirk Gouders <dirk@gouders.net>
>
> What actual symptoms does this bug have?
>
> I.e. it would be nice if the changelog started with such an explanation:
>
> Dirk Gouders reported that .... <bad stuff happens during kernel build> ...
> and bisected it back to:
>
> 98f78525371b ("x86/boot: Refuse to build with data relocations")
>
> The root cause of the bug is that the if_changed kbuild function ...
>
> Or something like that.
>
> Thanks,
>
> Ingo
Anyway, the code diff looks good to me.
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-18 5:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-15 2:56 [PATCH] x86/boot: Fix if_changed build flip/flop Kees Cook
2018-07-15 22:58 ` Ingo Molnar
2018-07-18 5:44 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).