Re: a Heisenbug tale

From: Rasmus Villemoes
Date: Sat Mar 10 2018 - 20:09:06 EST


On 2018-03-09 10:45, Ard Biesheuvel wrote:
> On 8 March 2018 at 23:19, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> wrote:
>> On 2018-03-07 20:25, Leonard Crestez wrote:
>>> Hello,
>>>

>>
>> What we ended up doing was to explicitly set the mtime of every file in
>> the repo to the same reference time after the git checkout (find ... |
>> xargs touch --date=...). I also wanted to send a patch to change the
>> Makefile to use the filechk mechanism to avoid updating the .S_shipped
>> file when the script produced identical output, but never got around to it.
>>
>
> I had no idea that _shipped files were causing issues like this, and
> AFAICT, this is not specific to this use case in arch/arm/crypto,
> right?
>
> Russell, would you mind if we removed the _shipped.S file here and
> just assume that perl is available?
>

Well, in that case I won't need to write a proper changelog for the
below, but this seems to work. It will of course still give the spurious
build failures when perl is not available and one hits the "files got
checked out at almost but not quite the same time", but it would have
prevented the spurious -dirty bug.


diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile
index 30ef8e291271..f0cec9a92fd8 100644
--- a/arch/arm/crypto/Makefile
+++ b/arch/arm/crypto/Makefile
@@ -54,13 +54,14 @@ crct10dif-arm-ce-y := crct10dif-ce-core.o
crct10dif-ce-glue.o
crc32-arm-ce-y:= crc32-ce-core.o crc32-ce-glue.o
chacha20-neon-y := chacha20-neon-core.o chacha20-neon-glue.o

-quiet_cmd_perl = PERL $@
- cmd_perl = $(PERL) $(<) > $(@)
+define filechk_perl
+ perl $<
+endef

$(src)/sha256-core.S_shipped: $(src)/sha256-armv4.pl
- $(call cmd,perl)
+ $(call filechk,perl)

$(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl
- $(call cmd,perl)
+ $(call filechk,perl)

.PRECIOUS: $(obj)/sha256-core.S $(obj)/sha512-core.S