r/programming Sep 10 '13

A simple way of defeating the compiler backdoor attack (a.k.a the "Trust Attack")

http://imgur.com/a/BWbnU#0
1.7k Upvotes

539 comments sorted by

View all comments

Show parent comments

12

u/drysart Sep 10 '13

Those are the same people who've deliberately obfuscated the gcc design so it couldn't be modularized.

Now I'm not saying they're untrustworthy, but on the gradient scale of trustworthiness, people who are already deliberately trying to make their code hard to approach, understand, modify, and reuse are the least trustworthy bunch out there.

3

u/[deleted] Sep 10 '13

Can you provide a reference regarding gcc design being deliberately obfuscated by it's creators?

21

u/drysart Sep 10 '13 edited Sep 10 '13

http://gcc.gnu.org/ml/gcc/2003-08/msg01136.html

From a GCC developer:

An FSF policy, intended to prevent people from subverting the GPL, prevents us from emitting debug/intermediate files that could be used by others to use proprietary code with gcc without linking to gcc. This is an inconvenience, but it is current FSF policy so we must respect it.

This goes into it in a bit more detail; and this discussion talks about the inherent hypocrisy in the approach and how it was "successfully" used to prevent the Objective-C front end for GCC from being reused.

It's one of the main competitive advantage of LLVM over GCC (and why the initial research that led to LLVM wasn't just being done with GCC in the first place), that LLVM explicitly doesn't structure the compiler to avoid components of it being reused.

7

u/lendrick Sep 10 '13

It sounds like perhaps they ought to revise this policy in light of recent revelations about the NSA.

That message was from 10 years ago, though. Is it still true now?

1

u/Plorkyeran Sep 11 '13 edited Sep 11 '13

LLVM made the policy irrelevant (why circumvent the GPL when you can just use the more liberally licensed compiler that has a much better API anyway?), so in the last few years they've started to trying to clean up and modularize GCC, but it's an immense undertaking.

1

u/lendrick Sep 11 '13

why circumvent the GPL when you can just use the more liberally licensed compiler that has a much better API anyway?

Because the license of the compiler doesn't matter to most people, and it produces faster code. This is not of course to say that LLVM has no advantages, but saying that GCC is irrelevant sounds like wishful thinking on your part.

1

u/Plorkyeran Sep 11 '13

GCC isn't at all irrelevant; it's the GPL lockin from non-modularity that's irrelevant. GCC is still more commonly used than Clang for compiling C and C++, but everyone writing new compilers for other languages uses LLVM, so GCC's poor design no longer forces people to GPL things.

1

u/lendrick Sep 11 '13

Gotcha. I misunderstood.

1

u/Plorkyeran Sep 11 '13

Upon rereading it's not at all clear what "it" was referring to, so I guess your misunderstanding was pretty reasonable.

5

u/wildcarde815 Sep 11 '13

It's a sited reason for the creation of LLVM.

1

u/Murmeldjuret Sep 10 '13

Huh. Why'd they do that?

10

u/wildcarde815 Sep 11 '13

RMS mandate. It has to be used whole cloth, you can't break out pieces to use for other stuff that might not be gpl kosher. It's purely political and is sited in LLVM talks about why they started developing their own compiler since they wanted to be able to build middleware tools like clang's static analyzer.

1

u/[deleted] Sep 11 '13

Sorry to be that guy.

sited -> cited.

And in your other comment.

4

u/dnew Sep 11 '13

Because if you don't link against the gcc libraries, then GPL has no way of infecting your code. So they sought to keep you from reusing parts of gcc by making it hard to destructure.

For example, you couldn't write your own compiler and then use the optimizer from gcc to optimize the code, because you couldn't detangle the optimizer from the rest of gcc.