5 ms·
How to make your software build reproducibly [pdf]
- voltagex_ 11y agoSee also http://media.ccc.de/browse/conferences/camp2015/camp2015-6657-how_to_make_your_software_build_reproducibly.html http://media.ccc.de/browse/conferences/camp2015/camp2015-665...
- agumonkey 11y agoAmazing, I forgot to watch it. The security issues mentioned are ... impressive. ps: the first minute seem silent but it's not a bug.
- lamby 11y agoIf you have any specifi cquestions, swing by #debian-reproducible on OFTC.
- voltagex_ 11y agoI did, thanks for your help - I think I'm one linker script away from a reproducible hello world.
- middleclick 11y agoReproducible builds are _amazing_. Just think about it: you are assured that the binary you are using corresponds to the source code. It is one of those ideas that makes you think why wasn't this done before?
- throwaway7767 11y agoThe reason it was not done before is that we did not find a solution to the "trusting trust" issue until quite recently. David Wheeler solved the problem and did his PhD dissertation on this in 2009: http://www.dwheeler.com/trusting-trust/ http://www.dwheeler.com/trusting-trust/ Once that was solved, reproducible builds became a lot more interesting as we no longer needed to trust the toolchain. As a result, all of the reproducible build projects mentioned in the PDF (debian, tor, bitcoin being the pioneers AFAIK) got started.
- geofft 11y agoReproducible builds are useful for purposes other than security, though. One day at work I found that we'd uploaded an updated binary artifact without checking in updated source (due to honest human error). We needed to patch the source, and if we dropped any patches, that could have caused regressions. I had a good guess about what the source was, but comparing the resulting binary involved dumping the resulting text sections and diffing them, and ignoring things like the debug sections. It would have been much simpler if I could simply recompile and make sure that the binaries were identical. If you're shipping binaries via a delta-update system (send the diff between what the user already has, and the new version), it's useful for things to change as little as possible. Reproducible builds allow you to send down an entire system (large application, bootable image, etc.) by recompiling the whole thing, which is good for build cleanliness, and trusting that unchanged files won't have changed. While not quite "reproducible builds", a lot of the related work means that if you apply a tiny patch to source code, the diff of that object file is probably equally tiny. I agree that this is a sort of "of course the compiler shouldn't introduce nondeterminism" thing. It happens to be primarily useful for security, but even in a non-security context, it's a nice base property to have.
- gavinpc 11y ago> Reproducible builds are useful for purposes other than security, though. I've been using an off-the-wall build system called Tup [0], which is designed to support optimally fast incremental builds (i.e. build times that don't scale with the codebase), and it calls for some of the same constraints, chiefly, a strictly deterministic build (no timestamps, control access to environment variables and all file IO). It even deletes generated files when they leave the graph for any reason (being philosophically opposed to a "clean" target). It's an opinionated tool, but it does deliver on its promise. The author also maintains (or at least used to maintain) a Linux repo/distro that is somewhat in the spirit of the OP, at least to the extent that git implements a kind of blockchain.[1] So yeah, there's considerable overlap between this and properties that I'd think everyone would want. The cost is a change in some habits. [0] http://gittup.org/tup/ http://gittup.org/tup/ https://github.com/gittup/tup/ https://github.com/gittup/tup/ [1] http://gittup.org/gittup/ http://gittup.org/gittup/
- nickpsecurity 11y agoYou are not assured the binary corresponds to the source code. Understanding why and eliminating this misconception is vital for FOSS community to prevent the saboteurs from getting in a better position of attack. A reproducible build by X different parties only shows that the source code was converted into a binary the same way X times. The conversion process could be malicious, buggy, and so on. The binary might be defective or a rootkit. This work does not mean the binary is trustworthy. Solving source-to-binary correspondence is a tougher problem whose solution I linked to in a comment below. You have to deal with malicious developers, interface issues, input validation, basic compiler bugs, optimization-induced security failures, undefined behavior, bootstrapping, and distribution. These projects mainly help with just that last part whereas most compiler-related, security failures are compiler/optimization bugs. Certifying compilers plus subversion-resistant development methodology and tools are only way to address others. Note: If you're curious, the cutting edge of this research is the CertiCoq project that is trying to produce an executable straight from a specification in Coq theorem prover. Many projects that eliminate entire classes of problems rely on Coq for specification of behavior and/or proof it's correct. Examples are CompCert compiler, Quark browser, and Chlipala's Bedrock. These typically get extracted into ML for regular compilation. A verified, transformation from Coq specification to executable code would be quite a leap past that and the ultimate tool for proving correctness of other tools. Especially true given how many solutions like above are built with it. They might automatically benefit. Work in progress, though.
- ilurk 11y ago> A more radical extension to the former approach is to actually check everything in your version control system. Everything as in the source of every single tool. That’s how it’s working when you are “building the world” on BSD-like systems. That’s also how Google is doing it internally. To make absolutely sure that everything is checked-in, you can even use “sandboxing” mechanisms > Google recently started open-sourcing the tool they use internally to drive such large scale builds under the name Bazel. So despite its syntax that I personally find hard to read, it’s probably worth checking out. Can anyone comment on the differences between Bazel and Debian's reproducible builds? Is the "Google is doing it internally" the same as Bazel? (they are eating their dog food [1]) If it is then, does Bazel allow building from a reference VM or docker instead of building every tool and library from source? What I'd like to know is what is worth adopting if you're in a small company (not a AmaGooFaceTwi). [1] https://plus.google.com/+RipRowan/posts/eVeouesvaVX https://plus.google.com/+RipRowan/posts/eVeouesvaVX
- walterbell 11y agoThis discussion of Bazel, by a Google Blaze user, identifies four issues for adoption of Bazel by OSS projects, http://julipedia.meroh.net/2015/04/on-bazel-and-open-source.html http://julipedia.meroh.net/2015/04/on-bazel-and-open-source.... 1. Cross-project dependency tracking 2. Software autoconfiguration 3. It's not only about the build 4. The Java blocker
- jschwartzi 11y agoWhat do you have to do to get Basel to "build" a target that its designers have never encountered? The biggest problem I have with modern build systems is that they invest a lot in building specific types of artifacts. For instance, you might be able to compile and link a C program in three or four lines. In exchange, they fail miserably to account for situations like statically linking raw binary data into an executable or facilitating the automation of a target image build. So it's usually easy to build a desktop application but not much else. How easy would it be to automate a complete Android image build in Bazel?
- devit 11y agoThis is really important work, hopefully it is completed as soon as possible. It basically allows multiple reputable people to independently build the code and sign a statement that a given source code hash produces a given binary hash (and that the source code hash is the correct one for a given package), and have the presence of at least a certain amount of these signatures be verified on package installation. This means that it will no longer be possible to backdoor Debian without changing source code by compromising the main build infrastructure.
- chocolait 11y agoAnother take of reproducible builds by Ted Unangst: http://www.tedunangst.com/flak/post/reproducible-builds-are-a-waste-of-time http://www.tedunangst.com/flak/post/reproducible-builds-are-...