Live data from Hacker News

Bootstrapping trust in compilers

owlfolio.org

11–20 of 21 posts

Re: Bootstrapping trust in compilers

#11
post #6
post #4

Trust is certainly one of the issues when languages migrate to requiring themselves to bootstrap. However, by far the most infuriating (and one I run into frequently in my line of work, hence the anger) is when you are trying to get the language running on a platform for which binary bootstraps do not yet exist. Portability matters. If you want your language to be useful and available to as many people as possible, w…

Pardon my ignorance, but why is cross-compilation not an option in this case?

Cross-compilation is sometimes an option, but not necessarily a good one.

It is usually a significantly manual process (I now have to download and install an OS which is supported by the runtime and build a cross-compiler for my target platform, which may or may not even be possible, or even work), isn't always supported by the runtime, usually requires changes to the build procedure, often requires special patches - and at the end of all that users are still left with either having to repeat all this themselves, or trust someone else's binary bootstrap.

Compared to a simple, portable, C-based bootstrap where any user can type 'make' and ensure provenance directly from source. For what gain?

Uninformed? Perhaps. I haven't designed and written my own language, and I'm certainly no expert. I'm just someone who gets asked to port these new languages to platforms which aren't Linux or OSX, and it's a lot of hard work. I just know that if I did it write my own it would look a lot more like perl/python/lua than ghc or go from a build perspective.

Re: Bootstrapping trust in compilers

#12
post #8

Given that today hardware is cheap and fast, why are we still using compiled languages? Plus using languages that requires source code at runtime help lower the barrier for newcomers.

By all means use Python if that's what you prefer! But it doesn't solve the problem discussed in the article: what if the Python binary has been compromised?

Re: Bootstrapping trust in compilers

#15
post #8

Given that today hardware is cheap and fast, why are we still using compiled languages? Plus using languages that requires source code at runtime help lower the barrier for newcomers.

By all means use Python if that's what you prefer! But it doesn't solve the problem discussed in the article: what if the Python binary has been compromised?

Yep I agree. I was talking about compiled _high-level_ languages.

Re: Bootstrapping trust in compilers

#16
Obligatory reference to previous HN discussion of Reflections on Trusting Trust by Ken Thompson [1].

I'd be interested in any war stories or links to compilers verified with things like: Cryptol [2], Coq [3] or Idris [4].

I've seen Cryptol prove equivalence for cryptographic algorithms written in C and Java. Would love to learn more about how this approach can or can't be applied to compilers.

1. https://news.ycombinator.com/item?id=2642486

2. http://www.cryptol.net/

3. https://coq.inria.fr/

4. http://www.idris-lang.org/

Re: Bootstrapping trust in compilers

#17
post #4

Trust is certainly one of the issues when languages migrate to requiring themselves to bootstrap. However, by far the most infuriating (and one I run into frequently in my line of work, hence the anger) is when you are trying to get the language running on a platform for which binary bootstraps do not yet exist. Portability matters. If you want your language to be useful and available to as many people as possible, w…

> However, by far the most infuriating (and one I run into frequently in my line of work, hence the anger) is when you are trying to get the language running on a platform for which binary bootstraps do not yet exist.

> Portability matters. If you want your language to be useful and available to as many people as possible, why would you seek to artificially limit the number of platforms it can be built on, just so you can avoid writing the bootstrap in C? I'm sure there is some amount of pride on the part of the language author when their language can bootstrap itself, but it certainly isn't a pragmatic decision.

This problem is easily solved by having a rule that each new version of the compiler must compile in an older version of the compiler. The first few versions are written in C, and once the compiler is self-hosting, new versions of the compiler are compiled on older versions of the compiler. This gives you a path from C to the current version of the language.

In practice, this happens very naturally, because it's how compilers are usually written. Assuming you have version control and the first versions of the compiler are written in C, you usually have the ability to bootstrap up from C. The only thing missing in many projects is documentation and tooling for that process.

Re: Bootstrapping trust in compilers

#18
post #8

Given that today hardware is cheap and fast, why are we still using compiled languages? Plus using languages that requires source code at runtime help lower the barrier for newcomers.

1) nobody cares about newcomers. fuck 'em 2) you're crazy if you think there's no advantage in compiling code. scripts are fast, compile code is faster. we love faster code, don't we kids? 3) if you wanna be a html hairdressing, sit and ponce about with some lovely, lovely html, this week's javascript framework and css. some of us are writing games for complicated consoles, (limited) android devices or emulating system calls in code converted from old, shitty languages into c++.

come back in 30 years.

Re: Bootstrapping trust in compilers

#19
post #8

Given that today hardware is cheap and fast, why are we still using compiled languages? Plus using languages that requires source code at runtime help lower the barrier for newcomers.

Well, ultimately, some programs must be native.

But beyond that, off the top of my head, I'd say the primary reasons:

* performance

* memory usage (think resource restricted environments)

* performance

* no extra runtime needed

* performance

* start up overhead

* predictable performance (think real-time stuff)

* access to ubiquitous native APIs

* performance

Look at programs like Nginx or PostgreSQL.

They make crazy effective performance optimizations that are really only available to native code. Of course, not every program is a web server or a database, but they are compiled for good reasons, and those reasons apply to many other programs.

Re: Bootstrapping trust in compilers

#20
post #5

The trouble with KTH is that somebody could go through all of this song and dance, and it still wouldn't mean a thing because how do you trust them?

You don't trust them. The result of this endeavor is not a trustworthy compiler, the result is a procedure to generate one. Every step in the procedure can and should be verified independently. What this buys you is a procedure that produces a trustworthy compiler given your initial environment is trustworthy. The latter still being an issue of course.
Post reply on HN