LWN: Comments on "Bootstrappable builds" https://lwn.net/Articles/841797/ This is a special feed containing comments posted to the individual LWN article titled "Bootstrappable builds". en-us Sat, 30 Aug 2025 05:16:45 +0000 Sat, 30 Aug 2025 05:16:45 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Bootstrappable builds https://lwn.net/Articles/843201/ https://lwn.net/Articles/843201/ geert <div class="FormattedComment"> Why not? It doesn&#x27;t make a difference if the logic gates are implemented by relays or semiconductors.<br> </div> Wed, 20 Jan 2021 10:15:30 +0000 Bootstrappable builds https://lwn.net/Articles/843161/ https://lwn.net/Articles/843161/ immibis <div class="FormattedComment"> Build the computer out of relays, surely.<br> <p> Of course, such a computer will occupy the size of at least a refrigerator, and execute perhaps 10 instructions per second.<br> <p> But you cannot possibly introduce fabrication defects into a relay-based design that passes its tests.<br> <p> Now you can use this to bootstrap your software for other computers that can actually run at practical speeds.<br> </div> Tue, 19 Jan 2021 17:57:59 +0000 Bootstrappable builds https://lwn.net/Articles/842947/ https://lwn.net/Articles/842947/ gdt <div class="FormattedComment"> The fabrication is shown to be correct using traceability. That is, every part of the proof is expressed in matching parts in hardware, and there is no additional hardware. This leads to a very different hardware design, one which will not perform well (eg, it&#x27;s desirable to have a very long instruction word, as that makes traceability easier, but there&#x27;s a high cost to fetching such instructions from memory. Especially since instruction caches and pipelines are very difficult to model, and so are usually not present).<br> <p> That&#x27;s the design issue for responding to Spectre. We want mathematical proof that processor designs don&#x27;t leak state between processes. But we don&#x27;t want to pay the price for the extreme proof and traceability of cryptographic processors.<br> </div> Mon, 18 Jan 2021 03:54:13 +0000 Choosing hardware for bootstraping and diverse double-compiling https://lwn.net/Articles/842923/ https://lwn.net/Articles/842923/ GNUtoo <div class="FormattedComment"> There are many issues that needs to be fixed to get a robust free software and open source infrastructure. <br> <p> Not all the issues affect everybody in the same way, so it&#x27;s still good to fix them.<br> <p> For instance for the Management Engine or equivalent, even if it&#x27;s present in most recent computers, in some cases it&#x27;s possible to avoid it completely.<br> <p> For storage devices (SSD, HDD, etc) firmwares, it&#x27;s still possible to workaround by booting off an SPI flash or raw NANDs and using LUKS on the mass storage device in a way that makes it very difficult for the firmware to attack the host system through modification of the data as everything is encrypted on it. For instance Coreboot/Libreboot+GRUB or u-boot/barebox + Linux + an initramfs can achieve that pretty easily.<br> <p> So being able to take out of the equation the compiler and what was needed to produce it (both the software and hardware) also makes trusting the software much more easier.<br> <p> In the case of Mes, as I understand it, it still depends on the system used to do the compilation which includes both the software and the hardware. In addition, getting the same binary out of a diverse double-compilation only ensure that either the backdoor is the same or that both have no backdoor.<br> <p> The issue is also that while we have some information on real world attacks (XcodeGhost) and that we basically know what it takes to do very simple compiler modifications that propagate themselves inside subsequent compilers being built, it&#x27;s hard to really understand the threat as some of the companies and government agencies that work on offensive security have large budgets and try to keep a big part of their work secret. In addition, not everything they do is published (for instance Edward Snowden probably didn&#x27;t retrieve and give everything that he had access to to the Journalists which probably didn&#x27;t publish everything either).<br> <p> That said, if we want to bootstrap a C compiler, we still need hardware and software.<br> <p> If I understood correctly with something like the stage0 implementation, we won&#x27;t need a kernel nor an operating system, and given enough work it could be used to somehow bootstrap a compiler, kernel and operating system.<br> <p> So I wonder what type of hardware would make sense to run a stage0 implementation:<br> - If you use Coreboot / Libreboot on a desktop (to avoid the issue of the embedded controller) with an I945 chipset (as there is free code to initialize the GPU / display controller), and find peripherals that you can somehow trust, you still end up having to build Coreboot / Libreboot, so it&#x27;s probably not the best option here. And you probably cannot review the assembly of the Coreboot / Libreboot image as they are way too big. As for writing a smaller version of them, they&#x27;d probably still end up being quite complex if we need RAM or access to a display controller. We can use the CPU cache as RAM quite easily though, but I&#x27;m unsure if that would be sufficient for the display controller part of the GPU and a very basic stage0. Installing that code would also be quite challenging as you&#x27;d need to trust some SPI flash programmer as well.<br> - Another approach would be to find an ARM SOC that has a bootrom that has been dumped and reviewed where users can easily input code and that has a display controller that don&#x27;t need complex software to be used. This still bring in the hardware as something users have to trust blindly.<br> - Yet another approach would be to use FPGAs like an ECP5 with something like LiteX and the free toolchain for it. Here you could review the HDL code but this brings in way more software dependencies as you need to actually produce the FPGA image.<br> - Another option would be to use very old and well known hardware (like an Altair 8800) and somehow manage to use that to bootstrap the stage0. Though they are probably not always easy to find.<br> <p> There are also procedure in place that could increase trust through randomness: the key signing ceremony, which is a procedure to setup an HSM can also be modified to be used for installing software but not necessarily for producing it.<br> <p> For instance if you want to install Coreboot / Libreboot and that you trust your SPI flash programmer and can build an image in a reproducible way, you can get random computer, remove the radios, install the software to talk to the SPI flash programmer and make all of them read/write the image to the SPI flash in a random order without giving any of them the ability to know if there will be another computer that will do the same thing right after. This way any computer can detect if what&#x27;s on the SPI flash is what is supposed to be there or if another computer has modified it. None of the computers will also be able to predict if they&#x27;ll be the last computer to check that flash chip.<br> <p> Denis.<br> </div> Sun, 17 Jan 2021 08:55:12 +0000 Bootstrappable builds https://lwn.net/Articles/842442/ https://lwn.net/Articles/842442/ Cyberax <div class="FormattedComment"> That was Linux kernel. An attacker hacked the public CVS mirror to include this code but this was caught by Larry McVoy noticing that BitKeeper history doesn&#x27;t match.<br> <p> Here&#x27;s the fine article from the LWN: <a href="https://lwn.net/Articles/57135/">https://lwn.net/Articles/57135/</a><br> </div> Wed, 13 Jan 2021 04:02:08 +0000 Bootstrappable builds https://lwn.net/Articles/842439/ https://lwn.net/Articles/842439/ mathstuf <div class="FormattedComment"> I remember hearing that too, but wasn&#x27;t it caught in a code review?<br> </div> Wed, 13 Jan 2021 03:20:26 +0000 Bootstrappable builds https://lwn.net/Articles/842434/ https://lwn.net/Articles/842434/ Wol <div class="FormattedComment"> <font class="QuotedText">&gt; With source code, it&#x27;d be relatively easy to miscompile a bug into a target like OpenSSL to open a security hole in a plausibly deniable way.</font><br> <p> Hasn&#x27;t this already happened? Didn&#x27;t somebody slip a &quot;if (userid = 0) then&quot; into some program a while back?<br> <p> And a lot of people are wondering if the NSA or whoever it was deliberately chose a bunch of Elliptic Curve Cryptography constants that were flawed to slip into a standard...<br> <p> Cheers,<br> Wol<br> </div> Wed, 13 Jan 2021 00:56:41 +0000 Bootstrappable builds https://lwn.net/Articles/842427/ https://lwn.net/Articles/842427/ dvdeug <div class="FormattedComment"> <font class="QuotedText">&gt; Only if you start with two different independent compilers, though. </font><br> <p> I was assuming that you compared to an existing GCC binary. You don&#x27;t actually have to start from two different non-GCC compilers; if you start from one non-GCC compiler and compare it to the product of an existing GCC binary, if the binaries are the same, then the attack isn&#x27;t present. If you want to start from two different independent compilers, there&#x27;s enough of them around. <br> <p> Also, a &quot;trusting trust&quot; attack for GCC 2.7.2 released in 1995 that targets a chain of compilers eventually building GCC 10 for AMD64, an architecture released in 2000, is inconceivable. (Toss in a pass through Itanium if you think AMD64 is even mildly plausible.) It would be challenging enough to make the attack survive cross-compiling from GCC 10 for AMD64 to GCC 10 for MIPS/ARM/HPPA/PowerPC and back to GCC 10 for AMD64.<br> <p> <font class="QuotedText">&gt; Source is harder, though, for multiple reasons.</font><br> <p> The OpenSSL bug was added through a patch. I&#x27;m not implying in any way it wasn&#x27;t an accident, but it was a serious security hole added through source change. For our purposes, the patch fixed a latent bug; OpenSSL relied on reading uninitialized variables, and there&#x27;s a large bit of rules lawyering on StackOverflow, enough that whatever the actual standard says, a change that detected such a problem and &quot;accidentally&quot; opened up a similar bug, even if limited to certain circumstances, could be plausibly denied to be malicious.<br> <p> <font class="QuotedText">&gt; The source of GCC or Clang might be huge, but any *one* change is much smaller and more reviewable.</font><br> <p> A bad actor wouldn&#x27;t post it for review upstream; you toss into Red Hat or Debian or FreeBSD&#x27;s patches, or stick it into some insecure mirror&#x27;s copy of the source. Or you use direct access to the git repository. <br> <p> <font class="QuotedText">&gt; And finally, malicious source code is more difficult to deny intent about. </font><br> <p> If GCC is bootstrapping itself and producing a different binary from another GCC bootstrap started from a different compiler, there&#x27;s almost certainly malicious action. (There have been cases where stage 2 and stage 3 won&#x27;t match, because the starting compiler miscompiled GCC, but not in an unsurvivable way, but you can run a stage 4 and it will match stage 3 and the final stage from other builds.) Once you&#x27;ve discovered the &quot;trusting trust&quot; attack, you can disassemble the binary and it will be obvious that malice was involved, because that couldn&#x27;t happen by accident. <br> <p> With source code, it&#x27;d be relatively easy to miscompile a bug into a target like OpenSSL to open a security hole in a plausibly deniable way. Once we&#x27;ve established malice, if Debian or Red Hat were shipping a compromised source or binary, it would trace back to the same paths, and much the same group of people could have slipped it into the supply chain.<br> <p> Again, the base issue is real, but I think when you start toggling in bootloaders, you&#x27;ve left real-world concerns behind.<br> </div> Tue, 12 Jan 2021 23:49:26 +0000 Bootstrappable builds https://lwn.net/Articles/842203/ https://lwn.net/Articles/842203/ eru <p>You are thinking of the VIPER. I recall reading a story about it in some magazine, possibly BYTE. Quick googling turned up the following 1987 paper from Royal Signals and Radar Establishment, with proper old military document vibe (marked UNCLASSIFIED, looks like an old photocopy) <p><a href="https://apps.dtic.mil/dtic/tr/fulltext/u2/a194561.pdf">https://apps.dtic.mil/dtic/tr/fulltext/u2/a194561.pdf</a> Sun, 10 Jan 2021 17:37:54 +0000 Debian 2008 keys bug https://lwn.net/Articles/842197/ https://lwn.net/Articles/842197/ aaronmdjones <div class="FormattedComment"> <font class="QuotedText">&gt; Any key generation requires random numbers and AIUI openssh relied on openssl for all it&#x27;s random number needs.</font><br> <p> Back then, it did, yes. OpenSSH 6.5 (adding support for Ed25519 keys) didn&#x27;t arrive for another 6 years, and OpenSSH 6.8 (allowing it to be built without OpenSSL) didn&#x27;t arrive for another year after that. These days you can build it without, and then it will use urandom(4) [Linux, among others] or arc4random(3) [OpenBSD].<br> </div> Sun, 10 Jan 2021 13:34:45 +0000 What about the linker? https://lwn.net/Articles/842185/ https://lwn.net/Articles/842185/ JoeBuck The traditional gcc bootstrapping process can work with all of the binutils tools, built together in the same tree (this was pioneered by the Cygnus folks maybe 30 years ago); everything is built again with the new compiler, linker, and assembler to eliminate dependencies. We can demonstrate that the classic attacks in the Thompson paper either don't exist, or have affected every C compiler since the dawn of the language, by starting with unrelated compilers, doing the bootstraps, maybe going through a number of compiler versions and even throwing in cross-compilers, involving a mix of free and proprietary compilers, and verifying that in the end the binaries are the same (for some systems, timestamps have to be filtered out of object files when doing the comparison, but for most, we wind up with every byte identical). <p> However, we still inherit dependencies from system libraries, and this can include macros and inline functions. Someone could perhaps sneak an attack into a system library function that needs to be coded in assembler for optimal performance, and have this wind up in the compiler. So efforts like these that start with a tiny compiler <em>and</em> a tiny library can eliminate that threat as well. <p> But I think efforts like this, while fascinating, are a lot less important than they used to be because the real threat these days is in the microcode, the system under the system. Sun, 10 Jan 2021 01:11:32 +0000 Debian 2008 keys bug https://lwn.net/Articles/842139/ https://lwn.net/Articles/842139/ plugwash <div class="FormattedComment"> Any key generation requires random numbers and AIUI openssh relied on openssl for all it&#x27;s random number needs.<br> <p> The key generation issue was awful, but at least you could recognise bad keys (debian shipped a package &quot;openssh-blacklist for a long time because of this), but even worse was that traditional implementations of DSA use random numbers during the signature process and can leak bits of the key if that randomness is not sufficiently random.<br> <p> This meant that any DSA key that had been merely used with the bad openssl had to be considered compromised. Since there was no way of detecting such keys, this lead to a ban in use of DSA keys on Debians infrastructure (no idea if other organsitions followed suite).<br> <p> Debian was very fortunate that while it is theoretically possible to transfer keys between the gnupg world and the openssl/openssh/x509 world it was enough of a PITA that people very rarely did. So gnupg (which is the root of identity/trust in the Debian project) could still be considered safe.<br> </div> Sat, 09 Jan 2021 02:11:00 +0000 Debian 2008 keys bug https://lwn.net/Articles/842136/ https://lwn.net/Articles/842136/ aaronmdjones <div class="FormattedComment"> The patch was to OpenSSL, specifically its random number generator, not OpenSSH. OpenSSH just happens to use OpenSSL for its RSA key generation, and RSA key generation requires a good source of random numbers.<br> </div> Fri, 08 Jan 2021 23:55:23 +0000 Bootstrappable builds https://lwn.net/Articles/842128/ https://lwn.net/Articles/842128/ Wol <div class="FormattedComment"> This to me is the perfect description of why Science IS NOT Mathematics.<br> <p> Mathematics is a provably correct logical model of what we think the world should be.<br> <p> Science is a description of what the world is. (Or rather, Science is the work involved in making sure reality and theory agree - most practitioners unfortuanately try to make reality agree with theory, rather than the other way round :-)<br> <p> Cheers,<br> Wol<br> </div> Fri, 08 Jan 2021 21:09:35 +0000 Bootstrappable builds https://lwn.net/Articles/842126/ https://lwn.net/Articles/842126/ josh <div class="FormattedComment"> <font class="QuotedText">&gt; GCC bootstraps itself, which means the final copy of GCC binaries for a certain architecture and GCC version should not depend on what compiler you started with.</font><br> <p> As long as the GCC binary didn&#x27;t have something added that subverts subsequent GCC binaries.<br> <p> <font class="QuotedText">&gt; If you start with two different compilers, you don&#x27;t need to absolutely trust them; if they came from different sources and any attack they&#x27;d be using would be different, you can simply compare the final versions and if the binaries are the same, which starting compiler you used was truly irrelevant, and the &quot;trusting trust&quot; attack is moot.</font><br> <p> Only if you start with two different independent compilers, though. The top-level comment of this thread just said &quot;bootstrapped a modern GCC from non-GCC source&quot;, which doesn&#x27;t say anything about diverse double-compilation (using two different non-GCC compilers to compile GCC).<br> <p> <font class="QuotedText">&gt; If you can get a hacked binary into the pathway, you can get hacked source code into the pathway.</font><br> <p> Source is harder, though, for multiple reasons.<br> <p> First, &quot;trusting trust&quot;-style attacks would be difficult to obfuscate; it&#x27;s one thing to hide a security hole, and quite another to hide code that detects a code pattern from a compiler and modifies it such that it affects subsequently compiled code.<br> <p> The source of GCC or Clang might be huge, but any *one* change is much smaller and more reviewable.<br> <p> And finally, malicious source code is more difficult to deny intent about. With a malicious binary, you could try to claim some internal process was subverted, or blame a random employee, or contractor, or other similar diversions. With malicious source code, you&#x27;ll have a harder time blaming anything other than malice.<br> </div> Fri, 08 Jan 2021 20:46:13 +0000 Bootstrappable builds https://lwn.net/Articles/842117/ https://lwn.net/Articles/842117/ jhhaller <div class="FormattedComment"> It&#x27;s not just the ME, there&#x27;s firmware everywhere, in storage (both controller and drives), in the NIC, in the BIOS or other bootstrap code.<br> <p> If one is trying to defend against state actors, there is no end to the potential attacks, especially if they are only attacking one entity.<br> Once they know the defense, it&#x27;s easier to discover other places to attack.<br> <p> I remember a British effort to build a mathematically verified computer, so that the results could be provably correct. The problem, as I remember,<br> is that the computer was a physical device which could have existing and new defects, even if the design was proved correct,<br> yielding the provably correct program potentially giving an incorrect answer. There is no way to prove that the fabrication of the<br> verified design was correct. I can&#x27;t find the original source, I believe this was done in the 80&#x27;s.<br> </div> Fri, 08 Jan 2021 17:58:04 +0000 What about the linker? https://lwn.net/Articles/842052/ https://lwn.net/Articles/842052/ eru <p>Should we not also take into account the "ld", "ar" and other bintools? I think the Thompson attack would also work with "ld" and any other tool that is used in the process of generating the final program. <p>So the bootstrap process should either start with a compiler that directly produces an executable, or also bootstrap the linker without depending on any existing linker. Fri, 08 Jan 2021 07:00:12 +0000 Bootstrappable builds https://lwn.net/Articles/842049/ https://lwn.net/Articles/842049/ dvdeug <div class="FormattedComment"> I&#x27;m not sure I understand what type of malware you are referring to. <br> <p> GCC bootstraps itself, which means the final copy of GCC binaries for a certain architecture and GCC version should not depend on what compiler you started with. If you start with two different compilers, you don&#x27;t need to absolutely trust them; if they came from different sources and any attack they&#x27;d be using would be different, you can simply compare the final versions and if the binaries are the same, which starting compiler you used was truly irrelevant, and the &quot;trusting trust&quot; attack is moot.<br> <p> I don&#x27;t see how this has utility in build farms, either. The issue where bootstrapping matters is in compilers where attacks can be hidden in the binaries. You&#x27;re not going to build GCC fresh on every system, and there&#x27;s a serious question whether downloading a trusted source and building it on a million systems is any safer than downloading a trusted binary and building it on a million systems. If you can get a hacked binary into the pathway, you can get hacked source code into the pathway.<br> </div> Fri, 08 Jan 2021 06:48:50 +0000 Bootstrappable builds https://lwn.net/Articles/842051/ https://lwn.net/Articles/842051/ marcH <div class="FormattedComment"> <a href="https://en.wikipedia.org/wiki/Attack_surface#Surface_reduction">https://en.wikipedia.org/wiki/Attack_surface#Surface_redu...</a><br> </div> Fri, 08 Jan 2021 06:23:49 +0000 Bootstrappable builds https://lwn.net/Articles/842042/ https://lwn.net/Articles/842042/ goraxe <div class="FormattedComment"> There have been malware in the wild that does attack tool chains and software has been put out that has had backdoors inserted by software houses affected by this type of malware. There is no guarantee that non gcc C compiler is trusted. <br> <p> So the bootstrapping from tiny understandable principles is pretty interesting especially if the results are bit for bit comparable as this gives cryptographic verification options.<br> <p> I could see this having utility in build farms like travis ci, paas systems like aws lambda, google app engine etc. If you need truly trusted binaries this seems like a very viable way of getting them<br> </div> Fri, 08 Jan 2021 03:23:16 +0000 Bootstrappable builds https://lwn.net/Articles/841964/ https://lwn.net/Articles/841964/ dgm <div class="FormattedComment"> You can, to some extent. At this level of complexity trust is basically statistical, meaning that you trust bacause it would be rather difficult to tamper all the pieces and go undetected for long. But you cannot be certain.<br> <p> The only absolutely trustable computer is the one you create yourself from discrete logic and only runs software written by yourself.<br> </div> Thu, 07 Jan 2021 12:36:27 +0000 Bootstrappable builds https://lwn.net/Articles/841962/ https://lwn.net/Articles/841962/ tsr2 <div class="FormattedComment"> The hardware/firmware backdoor that means we can&#x27;t trust any of this ever, on Intel hardware at least, is Intel ME.<br> <p> <a href="https://en.wikipedia.org/wiki/Intel_Management_Engine">https://en.wikipedia.org/wiki/Intel_Management_Engine</a><br> </div> Thu, 07 Jan 2021 12:05:33 +0000 Bootstrappable builds https://lwn.net/Articles/841954/ https://lwn.net/Articles/841954/ andrewsh <div class="FormattedComment"> E.g. Kotlin.<br> </div> Thu, 07 Jan 2021 08:50:52 +0000 Bootstrappable builds https://lwn.net/Articles/841942/ https://lwn.net/Articles/841942/ pabs <div class="FormattedComment"> For trusting source code, there will always be too much code for one developer or one organisation to review. So we need distributed code review, which is being worked on in the rust community.<br> <p> <a href="https://github.com/crev-dev/crev">https://github.com/crev-dev/crev</a><br> <a href="https://github.com/crev-dev/cargo-crev">https://github.com/crev-dev/cargo-crev</a><br> </div> Thu, 07 Jan 2021 03:13:08 +0000 Bootstrappable builds https://lwn.net/Articles/841939/ https://lwn.net/Articles/841939/ pabs <div class="FormattedComment"> Its sad to see that lots of programming languages and build tools aren&#x27;t bootstrappable, or are only tortiously bootstrappable from a minimal Linux system.<br> </div> Thu, 07 Jan 2021 01:04:11 +0000 Bootstrappable builds https://lwn.net/Articles/841924/ https://lwn.net/Articles/841924/ dvdeug <div class="FormattedComment"> It&#x27;s interesting, but it seems to be wandering into purely academic technicalities. Once you have bootstrapped a modern GCC from non-GCC source, you&#x27;re done for GCC&#x27;s part; you have a trusted compiler assuming you can trust the source code, in the sense of Ken Thompson&#x27;s article. The problem is not making the core smaller; the problem is the GCC tarball, uncompressed, is 740 MB, and even after stripping away various documentation and non-C/C++ directories, it&#x27;s still over 200 MB. How do you trust that? <br> <p> In 2008, there was a problem with Debian SSH keys due to an actual patch to OpenSSH in Debian. This was accidental and a patch to OpenSSH. It would have been harder but possible to do it intentionally and via a patch to GCC, so it would recognized OpenSSH and miscompile it as needed. It could be all written out in code, and nobody would be the wiser unless they knew what they were doing GCC-wise and were poking at that section of code.<br> <p> It&#x27;s not a bad concern, but it seems at this point to be more about something fun and interesting instead of something that provides any more trust in practice.<br> </div> Thu, 07 Jan 2021 00:53:00 +0000