@SRAZKVT you can use my fractal zip format for this purpose actually (one of the design goals was representing a dataset with changes over time). that's actually a really fascinating corollary of using it to represent atomic transitions between reproducible filesystem states....................i did not realize that VCS is precisely a formulation of atomic filesystem transactions. need to think about this further
anyway, this guy's website is named "vulns" and his work is sponsored by google and the linux foundation https://vulns.xyz/2021/07/disagreeing-rebuilders/
[we will return to the kernel now. i promise this was necessary]
Disagreeing rebuilders and what that means - vulns.xyz
let's refresh our memory on the module signature problem statement: https://lwn.net/Articles/1012946/
This mechanism, which checks module integrity based on hashes computed at build time instead of using cryptographic signatures
this is where we can finally start to describe why that justification makes absolutely no fucking sense!
a signature is essentially just the result of encrypting a checksum with a private key, so anyone can decrypt with the corresponding public key to obtain the checksum.
it's true that there are other ways with more constraints, but the standard methods like EdDSA quite literally accept an arbitrary cryptographic hash function (checksum) as a parameter.
that checksum is in fact exactly the information we need for "reproducibility"! and we very much do want to ensure we have the exact same checksum as was generated by the upstream maintainer--that's what the public key verification achieves!
the cryptographic "proof" resulting from a private key-based checksum signature is very specifically the human assurance that the human owner of that private key must have generated the corresponding checksum!
if we accept that a cryptographic checksum is "proof" of reproducibility, then a signature scheme is strictly more powerful--proof of reproducible output, and proof that the output checksum was not modified after being generated by the holder of the private key!
let's take a look at that patch series now.
lwn complains about AI scrapers when you try to access their locally hosted copy of diffs from LKML. https://web.archive.org/web/20250409044448/https://lwn.net/ml/all/20250120-module-hashes-v2-2-ba1184e27b7f@weissschuh.net/
(why not just link to LKML if they're getting scraped so hard? if you ask questions like this you will not like the answers you find)
this diff [2/6 in the patchset] adds a new config option that disables the existing config option to enforce signature checking. real Kconfig heads will understand that this config dependency is equivalent to an override mechanism. so you can disable module signing even if the user config requires it.
that's not even the cryptographic part yet, just an extra build system backdoor. the cryptographic claims are next.
this is the magnum opus of the reproducible builds evangelism strike force: https://web.archive.org/web/20250408191140/https://lwn.net/ml/all/20250120-module-hashes-v2-6-ba1184e27b7f@weissschuh.net/. let's evaluate these claims:
The current signature-based module integrity checking has some drawbacks in combination with reproducible builds:
drawbacks in combination? that makes it sound like reproducible builds are a simple config setting. that would be nice, right? if reproducible builds had precise semantics? and they fucked off and stopped bothering everyone else?
Either the module signing key is generated at build time, which makes the build unreproducible,
we're going to examine this claim in more detail presently. but first we absolutely need to highlight the rest of this sentence:
or a static key is used, which precludes rebuilds by third parties and makes the whole build and packaging process much more complicated.
i cannot possibly express the violent feelings within me upon reading this statement:
- a "static key" refers to "literally a normal key, the way it worked before".
- does it "preclude rebuilds by third parties"? (we will evaluate this below.)
- "makes the whole build and packaging process much more complicated" -- again, this is literally the way it works right now.
so the reproducible builds evangelism strike force get to whine about how complicated it is to make the build reproducible. if you hate your job then maybe choose a different line of work?
but [6/6] in this patchset has so much more to show us! here is the the reproducible build squadron's best and brightest, making things less complicated:
diff --git a/Documentation/kbuild/reproducible-builds.rst
b/Documentation/kbuild/reproducible-builds.rst
index f2dcc39044e66ddd165646e0b51ccb0209aca7dd..6a742ad745113a9267223b33810dbc7218c47d4c 100644
--- a/Documentation/kbuild/reproducible-builds.rst
+++ b/Documentation/kbuild/reproducible-builds.rst
@@ -79,7 +79,10 @@ generate a different temporary key for each build, resulting in the
modules being unreproducible. However, including a signing key with
your source would presumably defeat the purpose of signing modules.
-One approach to this is to divide up the build process so that the
+Instead ``CONFIG_MODULE_HASHES`` can be used to embed a static list
+of valid modules to load.
+
+Another approach to this is to divide up the build process so that the
unreproducible parts can be treated as sources:
1. Generate a persistent signing key. Add the certificate for the key
so, instead of forcing our brave and noble reproducible builds advocates to suffer the cruel and unusual punishment of "splitting up the build process", we now have the much less complex alternative of "adding a backdoor in Kconfig that short-circuits signature checking at runtime"
recall lwn's comment on this dastardly mathematical trickery:
It's tempting to search for a clever cryptographic solution, but nobody has yet proposed one.
i had earlier today developed a lengthy protocol that would have solved a much harder problem, but i've just realized i was still giving them far too much credit.
this isn't a "clever cryptographic solution". they're using deterministic fucking signatures. reproducing the build just means providing a private key to the build process, the method that is already supported for module signing.
it's right there in Documentation/admin-guide/module-signing.rst:
(4) :menuselection:`File name or PKCS#11 URI of module signing key`
(``CONFIG_MODULE_SIG_KEY``)
Setting this option to something other than its default of
``certs/signing_key.pem`` will disable the autogeneration of signing keys
and allow the kernel modules to be signed with a key of your choosing.
you can even sign off by hand:
To manually sign a module, use the scripts/sign-file tool available in
the Linux kernel source tree. The script requires 4 arguments:
1. The hash algorithm (e.g., sha256)
2. The private key filename or PKCS#11 URI
3. The public key filename
4. The kernel module to be signed
so reproducible builds advocates claim to understand cryptography enough to interpret a cryptographic checksum, but they don't seem to understand that signatures are strictly more powerful proofs than checksums, even though the module signing guide makes it quite clear that signatures are just checksums++.
so, what do they mean by "rebuilds", and what does the CONFIG_MODULE_HASHES backdoor let them achieve?
well, first let's recall the final word of warning from module-signing.rst:
Since the private key is used to sign modules, viruses and malware could use the private key to sign modules and compromise the operating system.
well, i wouldn't go so far as to call arch linux distro packagers "viruses and malware". that's a little harsh.
The private key must be either destroyed or moved to a secure location and not kept in the root node of the kernel source tree.
this is, of course, exactly what CONFIG_MODULE_HASHES does, enabling viruses and malware to sign modules and compromise the operating system.
but surely i'm mistaken. let's check lwn again:
If the signing keys are publicly available for use in recreating the build, malicious actors could also sign modified loadable modules with them.
that is indeed exactly what module-signing.rst warned us about!
If they aren't publicly available, the build can't be reproduced.
you see what this means right? "reproduced" doesn't mean "reproduced". "reproduced" means "malicious actors can also sign modified loadable modules".