From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YGj2JxRKPmJ/KgEAgWs5BA (envelope-from ) for ; Sat, 26 Mar 2022 00:02:44 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GH3gIBRKPmKN2gAAG6o9tA (envelope-from ) for ; Sat, 26 Mar 2022 00:02:44 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F3FB77F97 for ; Sat, 26 Mar 2022 00:02:43 +0100 (CET) Received: from localhost ([::1]:39696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXsx9-0004kh-79 for larch@yhetil.org; Fri, 25 Mar 2022 19:02:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXswy-0004kS-FD for guix-devel@gnu.org; Fri, 25 Mar 2022 19:02:32 -0400 Received: from [2a00:1450:4864:20::42c] (port=46849 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXsww-0002Ja-Tk for guix-devel@gnu.org; Fri, 25 Mar 2022 19:02:32 -0400 Received: by mail-wr1-x42c.google.com with SMTP id h4so12623562wrc.13 for ; Fri, 25 Mar 2022 16:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=YuL7sv03q6LtUY7Qjv1S+a3H2ZmbReb+MkRTQiHa+vc=; b=Gn5+4gQNrz8d972xULyvnJxXBZcYtZ5Rchp6b78gellIaTXFRdjrXwbz9jMJi55Mb5 P7kb9yMrpybe1n3ct9susE4BHlSndM+qX1FijZ0+QovF4p9gdOoflruW19suwQ0lbtTe rCDu1CODROOZHqQgSCd2J+OK1HKwNqM7EvJuJmF0KXbSbiB1DVlTh1wWvfmZtzx37l1Q 4h9BQ4hIV5JAaakhu2bRV1vArC1OcIMvTZCLbtOcHJo/N7Ce2SMJNTrvJuucK6AUlVmr ZGtUMoCsuH1wgjq1F5ef/4TrF01jfe99iiLiCtnBIvnx3Ehjw8CtA/HyZI4TJ47JhtPm MY8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=YuL7sv03q6LtUY7Qjv1S+a3H2ZmbReb+MkRTQiHa+vc=; b=vkT2CQ3UBY9aafxE0hFEgJIfuEP/YgsbGCjvl1lb+q+36OUvwXGEIlnpyWQXoGXxZN 1DUGk8kv9p3x/6d16S0tkVL2gFg0chl1oIA49IjFXSse9bPbZHWtTZ4mPne/F/YJJswO vYlD++KZXzIDWtxOWzcmZfEkrITIpFHUTjlI5UVoPVCl5oXIXDjRI2p1W36NAXuZFcOM 4JGQep8MhYZkw9Ou2aL9tnam+PyyQIq3Prtyg9H8rlNstNOvceq/hBqGT8JhKa1KOIBK 1rCWYmPqHYi/yHK6Gwd759yJa5tokziE/mjb9gOIHNmUiSobxQugMedgy7zpo7PROjYo jl1g== X-Gm-Message-State: AOAM5317lE3d4jufHu3kF1H+pOfBdTnqIpExEUGWkDZTYLGCppC/nyRn 5W1U1stJO+xCEiH8/Y1csLU/BLnLUrA= X-Google-Smtp-Source: ABdhPJzFieLMGFF+FfxPl/mrjVKXDlWwyZeNGjB4WPX/BKM41pRKIBB5CRRfZSBVGKjh6kmVUYPpFA== X-Received: by 2002:adf:e6ce:0:b0:203:d9cb:a1b4 with SMTP id y14-20020adfe6ce000000b00203d9cba1b4mr11359721wrm.140.1648249349042; Fri, 25 Mar 2022 16:02:29 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id o11-20020adf9d4b000000b001f0077ea337sm6322350wre.22.2022.03.25.16.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 16:02:28 -0700 (PDT) From: zimoun To: kiasoc5@tutanota.com Subject: Re: Hardened toolchain In-Reply-To: References: <874k3r8m4m.fsf@gmail.com> <86y2119580.fsf@gmail.com> Date: Fri, 25 Mar 2022 23:54:26 +0100 Message-ID: <864k3l4p99.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648249364; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=YuL7sv03q6LtUY7Qjv1S+a3H2ZmbReb+MkRTQiHa+vc=; b=Ibxka0ItemXnRxo1PvH/1wI0dktf8kFUe6JKEsK50+EuM1CQEdxrg13r+HvLcgwJqjFgmx uHCBBzcYAMElBgTDH7NZ64z9MRKfj0w5Ok73P5l52MxUtWGDOJ7WKJqGRrQuJFlJ/w8nh/ EriisVO4TY/WJMKpASv1FCPfVfS9+UJl9wnnjeYvBk6ZgbwQKuGrKHcJ2B9p5IT0vg8/W9 kx4/aD1eBSmtCQRMqpv1SJwR2gtfiKyG67x2NP9OIgdrOQTNoGcX3+aK/NXfgrUT59Y1+o AAGihNxl36pGLqAuI78XoZYTylP82LKRCFb0g1dA2A4g1E+o/59SGU4B/itB5w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648249364; a=rsa-sha256; cv=none; b=G4YmXt4hMRnNoEoiVQ4t74AmB1rIcsnDy20Mr5+rAtlMTPMmF7wJ86/rqqMjBwlYf1Y3DD xjCjWD5v4TIoQ0K3LQMiWX1kd3HlEqNgB00yqo3K0c2U5GK3pN4Yq8uTXnRV0s91IrtuqU ddIwVPvr9U1BPYCgIhrSbre4YEOmDvc2u5Mnpg+ENVs8Oq/b6PrtwTH73j4B4DziCbYmOi sh+F462EFlkGUQt2jJyE4X/fhBDm0200e0AwJ2Ql4tF8EOBFYwZFOuK+/Yfc1PR1GTUa/D TmCjyCGsPXP/KTGvPVf0V7qAxjgDwKvG02vCca7HihukOzyQpul8hrJ0WLVNgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Gn5+4gQN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -9.08 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Gn5+4gQN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: F3FB77F97 X-Spam-Score: -9.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: fLBLD38AyqjU Hi, On Fri, 25 Mar 2022 at 20:39, kiasoc5@tutanota.com wrote: > =3D=3D=3D=3Dthe middle of guix build -f hardened.scm=3D=3D=3D=3D > building /gnu/store/1nlrgg5ryl486haw0kdqnbp4wa17lhwh-gcc-10.3.0.drv... > Backtrace: > In ice-9/eval.scm: > =C2=A0=C2=A0 217:50 19 (lp (# ?)) > =C2=A0=C2=A0 217:50 18 (lp (# ?)) > =C2=A0=C2=A0 217:50 17 (lp (# ?)) > =C2=A0=C2=A0 217:50 16 (lp (# ?)) > =C2=A0=C2=A0 217:50 15 (lp (# ?)) > =C2=A0=C2=A0 217:50 14 (lp (# ?)) > =C2=A0=C2=A0 217:50 13 (lp (# ?)) > =C2=A0=C2=A0 217:50 12 (lp (# ?)) > =C2=A0=C2=A0 217:50 11 (lp (# ?)) > =C2=A0=C2=A0 217:50 10 (lp (# ?)) > =C2=A0=C2=A0 217:50=C2=A0 9 (lp (# ?)) > =C2=A0=C2=A0 217:50=C2=A0 8 (lp (# ?)) > =C2=A0=C2=A0 217:50=C2=A0 7 (lp (# ?)) > =C2=A0=C2=A0 217:50=C2=A0 6 (lp (# ?)) > =C2=A0=C2=A0 217:50=C2=A0 5 (lp (# ?)) > =C2=A0=C2=A0 217:50=C2=A0 4 (lp (# ?)) > =C2=A0=C2=A0 217:33=C2=A0 3 (lp (# ?)) > =C2=A0=C2=A0=C2=A0 159:9=C2=A0 2 (_ #(#(# #f) #f)) > =C2=A0=C2=A0=C2=A0 159:9=C2=A0 1 (_ #(#(# #f) #f)) > In unknown file: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0 (string-ap= pend "LDFLAGS=3D" "-Wl,-rpath=3D" #f "/lib " "-W?" ?) > > ERROR: In procedure string-append: > In procedure string-append: Wrong type (expecting string): #f > builder for `/gnu/store/1nlrgg5ryl486haw0kdqnbp4wa17lhwh-gcc-10.3.0.drv' = failed with exit code 1 > build of /gnu/store/1nlrgg5ryl486haw0kdqnbp4wa17lhwh-gcc-10.3.0.drv failed > View build log at '/var/log/guix/drvs/1n/lrgg5ryl486haw0kdqnbp4wa17lhwh-g= cc-10.3.0.drv.gz'. > guix build: error: build of `/gnu/store/1nlrgg5ryl486haw0kdqnbp4wa17lhwh-= gcc-10.3.0.drv' failed > =3D=3D=3D=3Dthe middle of guix build -f hardened.scm=3D=3D=3D=3D You are creating a cycle, no? It is not a DAG and so the transformation fails, no? For instance, this: --8<---------------cut here---------------start------------->8--- (use-modules (guix packages) (gnu packages gcc) (gnu packages base)) (define make-gcc-toolchain (@@ (gnu packages commencement) make-gcc-toolchain)) (define gcc-bis (package (inherit gcc) (version (string-append (package-version gcc) "-bis")))) (define gcc-toolchain-bis (make-gcc-toolchain gcc-bis glibc)) (define (package-with-c-toolchain-bis package) (package-with-c-toolchain package `(("toolchain" ,gcc-toolchain-bis)))) (package-with-c-toolchain-bis gcc-bis) --8<---------------cut here---------------end--------------->8--- fails with the same message. There is bootstrapping issue: the binary of gcc-bis is required to compile the source of gcc-bis; where does come from such binary of gcc-bis? Considering your use case, you need: - gcc considered as binary seed =20 - use this binary gcc with the hardened options to compile the source of GCC; resulting to the binary gcc-hardened-1 - use this binary gcc-hardened-2 with the hardened options to recompile the source of GCC; resulting to the binary gcc-hardened-2 - if checksum(gcc-hardened-1) =3D=3D checksum(gcc-hardened-2) then use this binary to define a new toolchain else reach the fixed point fixed point: use this binary gcc-hardened-{n-1} to compile the source of GCC and output the binary gcc-hardened-{n}; compare the checksum of the binary {n-1} and {n} and repeat until equality is reached. Guix is not auto-magically resolving the fixed-point, i.e., it does not unroll the cycle by magic. :-) You have to do it manually or write code for automatise the process; described above. Hope that helps. Cheers, simon