You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you enable CONFIG_GCC_PLUGIN_RANDSTRUCT, you will need to pre-generate the random seed in scripts/gcc-plugins/randomize_layout_seed.h so the same value is used in rebuilds.
Reproducible builds are working. There are a few exemptions required, among the suite of tests that reprotest runs, but overall it works fairly well. In order to get fully deterministic builds I had to patch the kernel build logic itself, to get the debian changelog for the kernel image to support SOURCE_DATE_EPOCH, rather than calling out to date -R every time. Since the build logic in this repo already supports sideloading patches, that's not a huge deal, but calling it out for special attention.
The changes in #6 got us pretty far: we now have reproducible deb builds for a very small kernel config. For SD kernels in #7, however, the debs still aren't reproducible, almost certainly due to CONFIG_GCC_PLUGIN_RANDSTRUCT seed value mentioned above.
For the RANDSTRUCT issue, my current idea is we have a fixed seed stored (encrypted) in the infrastructure repo alongside the grsecurity credentials, that kernel builders export as an environment variable that the build script will dump into the correct file. Then we just need to ensure that it does not end up in the orig tarball that is distributed.
Also note that in the linked documentation, the filename has changed, but that only happened in 5.19 (torvalds/linux@be2b34f) so we still need to use the old one for our 5.15.
There's something else going on, the diffoscope output was mostly useless to me (it's all assembly and stuff). I'm going to stop working on this now since it appears to require more work than expected.
Discussion w/ Mickael and Conor in Montreal was that at some point these builds were reproducible. I had Claude take a look and it found 4 other things in addition to the known RANDSTRUCT problem:
For the first three, the seeds are publicly available in the headers package we publish, and even then, could be reconstructed from e.g. unpacking vmlinux. So we should just switch to deterministic seeds.
For module signing, we should be able to just turn it off, the key is generated and build time and then we throw it away, so it's useless.
Activity
conorsch commentedon Jan 11, 2021
Reproducible builds are working. There are a few exemptions required, among the suite of tests that
reprotestruns, but overall it works fairly well. In order to get fully deterministic builds I had to patch the kernel build logic itself, to get the debian changelog for the kernel image to support SOURCE_DATE_EPOCH, rather than calling out todate -Revery time. Since the build logic in this repo already supports sideloading patches, that's not a huge deal, but calling it out for special attention.conorsch commentedon Jan 13, 2021
The changes in #6 got us pretty far: we now have reproducible deb builds for a very small kernel config. For SD kernels in #7, however, the debs still aren't reproducible, almost certainly due to CONFIG_GCC_PLUGIN_RANDSTRUCT seed value mentioned above.
legoktm commentedon Aug 16, 2022
For the RANDSTRUCT issue, my current idea is we have a fixed seed stored (encrypted) in the infrastructure repo alongside the grsecurity credentials, that kernel builders export as an environment variable that the build script will dump into the correct file. Then we just need to ensure that it does not end up in the orig tarball that is distributed.
Also note that in the linked documentation, the filename has changed, but that only happened in 5.19 (torvalds/linux@be2b34f) so we still need to use the old one for our 5.15.
legoktm commentedon Aug 16, 2022
For reference, the format of the file is:
legoktm commentedon Aug 22, 2022
I injected a fixed random seed into the build process, ran two builds, and unfortunately it was not reproducible:
There's something else going on, the diffoscope output was mostly useless to me (it's all assembly and stuff). I'm going to stop working on this now since it appears to require more work than expected.
legoktm commentedon Aug 31, 2026
Discussion w/ Mickael and Conor in Montreal was that at some point these builds were reproducible. I had Claude take a look and it found 4 other things in addition to the known RANDSTRUCT problem:
For the first three, the seeds are publicly available in the headers package we publish, and even then, could be reconstructed from e.g. unpacking vmlinux. So we should just switch to deterministic seeds.
For module signing, we should be able to just turn it off, the key is generated and build time and then we throw it away, so it's useless.