unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / Atom feed
* Diverse Double-Compiling, --with-c-toolchain and trusting trust
@ 2020-10-14 11:29 zimoun
  2020-10-14 18:12 ` Joshua Branson
  2020-10-16 14:27 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: zimoun @ 2020-10-14 11:29 UTC (permalink / raw)
  To: guix-devel

Hi,

Reading the recent discussions about Reproducible Builds, see [1, 2, 3],
I was in the mood to use the recent option ’–with-c-toolchain’ to
demonstrate how Guix is cool!  But I have failed because I miss some UI,
I guess.

Well, my understanding of Diverse Double-Compiling can be summarized as:

Let’s consider that you have the source code of compiler (say ’tcc’
because it compiles fast) and 2 another compilers (say ’clang’ and
’gcc’).

| step | source | compiled with | produces |
|------+--------+---------------+----------|
| #1   | tcc    | clang         | tcc-A    |
| #2   | tcc    | tcc-A         | tcc-B    |
| #3   | tcc    | gcc           | tcc-C    |

Nothing ensures that tcc-{A,B,C} are bit-to-bit identical –– even they
should have different binary code –– but they are functionally
equivalent, or something is already wrong.

The next steps is to recompile:

| step | source | compiled with | produces |
|------+--------+---------------+----------|
| #4   | tcc    | tcc-B         | tcc-1    |
| #5   | tcc    | tcc-C         | tcc-2    |

And now, if everything is ok, then ’tcc-1’ and ’tcc-2’ must be
bit-identical.  Otherwise, the binaries ’clang’ *or* ’gcc’ are
compromised.  Assuming that the source code of ’tcc’ is audited and not
compromised. ;-)

If the source of the compilers used at step #1 and #2 are available,
then the same procedure can be applied to detect an attack.


Well, the idea is to implement the procedure with Guix: step #1,

  guix build tcc --with-c-toolchain=tcc=clang-toolchain

but then I do not know how to use the output to complete the step #2.
Is it possible to do it at the CLI level?  Or do I have to write some
Scheme?


Thank you in advance for any tips.

All the best,
simon

1: <https://lists.reproducible-builds.org/pipermail/rb-general/2020-October/002056.html>
2: <https://reproducible-builds.org/news/2019/12/21/reproducible-bootstrap-of-mes-c-compiler/>
3: <https://dwheeler.com/trusting-trust/#real-world>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Diverse Double-Compiling, --with-c-toolchain and trusting trust
  2020-10-14 11:29 Diverse Double-Compiling, --with-c-toolchain and trusting trust zimoun
@ 2020-10-14 18:12 ` Joshua Branson
  2020-10-14 20:03   ` zimoun
  2020-10-16 14:27 ` Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Joshua Branson @ 2020-10-14 18:12 UTC (permalink / raw)
  To: zimoun; +Cc: guix-devel


Hey zimoun!

This reminds me of the reflections on trusting trust:

https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf

If you get something like this working, and you'd like some help
assembling it into a blog post, please let me know!

Thanks,

--
Joshua Branson
Sent from Emacs and Gnus
https://gnucode.me
https://video.hardlimit.com/accounts/joshua_branson/video-channels
"You can have whatever you want, as long as you help enough other people get what they want." - Zig Ziglar


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Diverse Double-Compiling, --with-c-toolchain and trusting trust
  2020-10-14 18:12 ` Joshua Branson
@ 2020-10-14 20:03   ` zimoun
  0 siblings, 0 replies; 4+ messages in thread
From: zimoun @ 2020-10-14 20:03 UTC (permalink / raw)
  To: zimoun, Guix Devel

Dear,

On Wed, 14 Oct 2020 at 20:12, Joshua Branson <jbranso@dismail.de> wrote:

> This reminds me of the reflections on trusting trust:

Hehe!  The Diverse Double-Compiling (DDC) is a countermeasure against
Trusting Trust attack. :-)    If you are interested by the topic, one
entry point is one of this links:

1: <https://lists.reproducible-builds.org/pipermail/rb-general/2020-October/002056.html>
2: <https://reproducible-builds.org/news/2019/12/21/reproducible-bootstrap-of-mes-c-compiler/>
3: <https://dwheeler.com/trusting-trust/#real-world>

> If you get something like this working, and you'd like some help
> assembling it into a blog post, please let me know!

Thanks for the offer.  I will keep it in mind.


All the best,
simon


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Diverse Double-Compiling, --with-c-toolchain and trusting trust
  2020-10-14 11:29 Diverse Double-Compiling, --with-c-toolchain and trusting trust zimoun
  2020-10-14 18:12 ` Joshua Branson
@ 2020-10-16 14:27 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-10-16 14:27 UTC (permalink / raw)
  To: zimoun; +Cc: guix-devel

Hi!

Nice challenge! :-)

zimoun <zimon.toutoune@gmail.com> skribis:

> Well, the idea is to implement the procedure with Guix: step #1,
>
>   guix build tcc --with-c-toolchain=tcc=clang-toolchain
>
> but then I do not know how to use the output to complete the step #2.
> Is it possible to do it at the CLI level?  Or do I have to write some
> Scheme?

I think you’ll have to write Scheme because you really need to construct
a graph with leading to the diversely-compiled compiler.

Ludo’.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-16 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 11:29 Diverse Double-Compiling, --with-c-toolchain and trusting trust zimoun
2020-10-14 18:12 ` Joshua Branson
2020-10-14 20:03   ` zimoun
2020-10-16 14:27 ` Ludovic Courtès

unofficial mirror of guix-devel@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-devel/0 guix-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-devel guix-devel/ https://yhetil.org/guix-devel \
		guix-devel@gnu.org
	public-inbox-index guix-devel

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.devel
	nntp://news.gmane.io/gmane.comp.gnu.guix.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git