Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I read some stuff like cm bell labs but i couldn't get it all. How does it work really? What is the logic in that?

share|improve this question

marked as duplicate by gnat, Yusubov, Jalayn, StuperUser, Glenn Nelson Apr 12 '13 at 15:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 18 down vote accepted

Reflections on Trusting Trust is a lecture by Ken Thompson in which he explains the hack. Briefly:

  • he hacked /bin/login to introduce a backdoor.
  • he did this by hacking the compiler to introduce the backdoor into a binary whenever it detected that it was compiling the login source code.
  • he also hacked the compiler to introduce the backdoor-producing code into the compiler whenever it detected it was compiling that.

His point was that you might think "I don't trust this binary, I'll build it from source" but now you're in a state of recursive paranoia. If you don't trust the binary, why do you trust the compiler binary? You don't, so you build the compiler: but why do you trust the compiler binary to produce a trustworthy compiler?

share|improve this answer
He didn't actually do this; he merely claimed that it was possible. Never mind that doing step 2 reliably involves solving the halting problem (to determine whether source A is equivalent to source B, you must prove that they do the same, which includes determining whether both halt in the same circumstances) – MSalters Apr 12 '13 at 11:03
@MSalters "The actual bug I planted in the compiler would match code in the UNIX "login" command." – user4051 Apr 12 '13 at 11:33
@MSalters He did not attempt to insert on anything that might be a login command. He made it insert for the actual code in the actual login command that was actually in Unix. This is a much more tractable target, and his talk discusses exactly how to do that. – btilly Apr 12 '13 at 12:12
@RossPatterson: Then you have to enter the paper-tape bootstrap with toggle switches also, and only use the tape you (personally) created. – Pieter Geerkens Apr 13 '13 at 4:52
@PieterGeerkens you mean you trust the hardware to interpret the toggle switches correctly? You're brave. – user4051 Apr 15 '13 at 16:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.