unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: guix-devel@gnu.org
Subject: Diverse Double-Compiling, --with-c-toolchain and trusting trust
Date: Wed, 14 Oct 2020 13:29:47 +0200	[thread overview]
Message-ID: <86blh5jb9w.fsf@gmail.com> (raw)

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>



             reply	other threads:[~2020-10-14 11:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 11:29 zimoun [this message]
2020-10-14 18:12 ` Diverse Double-Compiling, --with-c-toolchain and trusting trust Joshua Branson
2020-10-14 20:03   ` zimoun
2020-10-16 14:27 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86blh5jb9w.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).