[Dev-luatex] Bug#1009196: texlive-binaries: Reproducible content of .fmt files

Roland Clobus rclobus at rclobus.nl
Mon Apr 11 16:34:00 CEST 2022

Hello Hans, Norbert,

Thanks for your answers.

On 11/04/2022 13:01, Norbert Preining wrote:
>> it actually defeats one of the security properties of lua (which was
>> explicitly introduced at some point: make sure that hashes have random order
>> each run so that it's harder to retrieve sensitive data from mem)
> Well, that is a good point to *not* implement the change.
> Roland, do you have any comments? I guess the reproducability strive is
> not as important as security.

Well, reproducibility is *another* aspect of security; this time not for 
the regular environments that users will use, but for build environments.

Reproducibility (as enforced by SOURCE_DATE_EPOCH) is typically enabled 
in an environment that generates binaries from source code for 
redistribution. It will guarantee that the build environment has not 
been tampered with, because you can (if you have made a similar build 
environment yourself) generate the binary files bit-for-bit identical. 
For a regular, production environment you should not have 

Other programming languages also have solved the security risks 
associated with the randomness of the hashes and reproducibility, see 
[1]. For Perl, the hashes can be de-randomized with PERL_HASH_SEED. 
For Lua an environment variable LUA_HASH_SEED could be introduced, or 
per default the value of SOURCE_DATE_EPOCH (if set) instead of 
time(NULL) could be used to seed the hashes.

The texlive-binaries in Debian contain an embedded copy of Lua 5.3. The 
Lua 5.4 version of luai_makeseed is more complex, see [2]. I'll write a 
feature request for Lua later, that is out-of-scope for this scenario.

> So if something in this way should be done, it would need to
> changes sort order if and only if FORCE_SOURCE_DATE=1 in the env
> (this is what has required for tex engines to obey SOURCE_DATE_EPOCH
> settings).
> Roland, if you have time, please adjust the patch to work within the
> above constraints.

Ack. Thanks for the pointer to luai_makeseed, that was some missing 
information that I needed. I'll post an updated patch soon (most 
probably much smaller and more elegant). As written above, the hash seed 
will be de-randomized only when both FORCE_SOURCE_DATE=1 and 

With kind regards,
Roland Clobus

[1] https://reproducible-builds.org/docs/stable-outputs/
[2] https://sources.debian.org/src/lua5.4/5.4.4-1/src/lstate.c/?hl=73#L73
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20220411/bbbf7017/attachment.sig>

More information about the dev-luatex mailing list