From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gMveIP7FQGJUDAAAgWs5BA (envelope-from ) for ; Sun, 27 Mar 2022 22:15:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iH5JHv7FQGJ/dwEA9RJhRA (envelope-from ) for ; Sun, 27 Mar 2022 22:15:58 +0200 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 350F219B41 for ; Sun, 27 Mar 2022 22:15:58 +0200 (CEST) Received: from localhost ([::1]:35178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYZIr-0007P7-0i for larch@yhetil.org; Sun, 27 Mar 2022 16:15:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYZIX-0007NI-Vt for guix-devel@gnu.org; Sun, 27 Mar 2022 16:15:43 -0400 Received: from [2a00:1450:4864:20::435] (port=42930 helo=mail-wr1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYZIT-0001WU-V2 for guix-devel@gnu.org; Sun, 27 Mar 2022 16:15:37 -0400 Received: by mail-wr1-x435.google.com with SMTP id r13so17578810wrr.9 for ; Sun, 27 Mar 2022 13:15:31 -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=AGWnob43lvAyjVZbDWFx1c7BWpYeXZifE1D7GOmYaXc=; b=ce5VOHErXRJXyCYoEObwhp8j4UH6vCPITOOYFMUhlhbYMnFJga/23uyJZ3CpoUmJBo RRtNrziHb9yU9yDXvzketNKCdy5WLJOH9k5vn3mD9RSczlFuCrmiRpzM4kzduO2RmRD0 fFsu+P7d3lO5Mrewr8gWa3d8enq4xAA+rwxBP+uHJHhtZu+ovIZjwgK7JNuqItu8b7ro qwqHFYm5RCt8LZrG2kRxE5F6+TwbWEmq9VKpkUNzYJwN1ZmCwSjOW6DsRjDGllm4nfqR X9N3C4YwZG6nvvno+dO5FtqOWLtWDdHvxB+XyIKtdUJsoEQbLnepqmcNRVDs+HZldrGA UXFg== 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=AGWnob43lvAyjVZbDWFx1c7BWpYeXZifE1D7GOmYaXc=; b=6ehd2zjGE/q8zwPD2h9EyAEytVRRTZjvtxiRoSSSsXXNHG2qlQ3ZTppG7/iDaFbSh0 rYsN+kYFU9MJ39y4pN3eUrNCj0/IrT3UjyRzg7ksxUbrJAWp4zfoit48w40gFrStZ+TT ulg6Gk8RGYuBsZUSpaaLCtA4N5Rs6wFF5563QK/KsrTYIBjp1xqUfG5zkQu0fO9iH+Eo 9Ezd7RrdocF77AXyZpLTSVqOBsiRbDU5zdMwoBh4rn3Tuxho2DooettetT/QEzXj86YK 6961y1G5XBqOg+up5zNtu5HvNtHqm/lMJRboNFS6U0jDy1aq0zJ0UBwFipKS2P1QCEMe u0QA== X-Gm-Message-State: AOAM531dhvQAmvGCiLJfGiBWc+rwTHD9xj4Tliw60D/KGh3cC7mxxGMS zQVs3hbniKUvZjzdI1Qsy8+fYn0pJyo= X-Google-Smtp-Source: ABdhPJydhkr6Cvgi0AWDdryGEuxDqPR/WZ/oH074v54y5B/0vAZj1DJh4ZVt8xg7NN0SCH6yggg7SQ== X-Received: by 2002:a5d:648c:0:b0:205:9a2c:aca3 with SMTP id o12-20020a5d648c000000b002059a2caca3mr16258295wri.565.1648412129521; Sun, 27 Mar 2022 13:15:29 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id h10-20020a05600c144a00b0038ccc75a6adsm9663802wmi.37.2022.03.27.13.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Mar 2022 13:15:29 -0700 (PDT) From: zimoun To: kiasoc5@tutanota.com Subject: Re: Hardened toolchain In-Reply-To: References: <874k3r8m4m.fsf@gmail.com> <86y2119580.fsf@gmail.com> <864k3l4p99.fsf@gmail.com> Date: Sun, 27 Mar 2022 22:06:33 +0200 Message-ID: <86k0cftb1y.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::435 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x435.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=1648412158; 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=AGWnob43lvAyjVZbDWFx1c7BWpYeXZifE1D7GOmYaXc=; b=CV6ttApGCk3lq8+DrYDbYkuNL5S4Ke1b+62U9X6IWMC0pq/I1gp8DzUC7vhZvLVhzAH0aX wlheFJkubPKqyUSBdho5NpQlEcz2WZ2kEpZM/uxtMVVmqAucDgOl4861XI9X5ImvUdOcRy Xk31nSgOOhMnTvDOFWUKQ3rT4W8Bobiprhyf7GM1Lnnhyk/Sb3QxaXvAAMc8WnCE1MkqeM SiJyNWzTmqBKNU80gLtiv0SUy9wdr1YkSCE84raeT/qEbC3bNrKK90CdAVcCgFis6co51h IU7gbP8tK1wMVfJOc0zh136hgnzfn4efbVK1tlP7IqFlb1r1/q/75DU+59D7yg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648412158; a=rsa-sha256; cv=none; b=HjTCWXY45mkEIIPtXjk/5GPGY9B4aZKj2ESPdMJoT/tAg9+yoja4AylWixYtlUi3vbLqDT rdXNvP2zCkvkqTuKCBSKHK0MD7YelPPls/EYs/aapKthrzKoaw0kgPMXHnf1BuGYwRuNCM RpPtWpzu8Y5103R0gxn3ysmv+jgMUXXEkHtVbCxMz/GB2DAkb93huNoJX2s+ziyq1TT1Yt 15zbW0ts933NuWhY9ORJJc0AEmlDkICkuhf5hp5jdfvtEj7Eb++UClwTcFxG3roQ+mceLb jArQ3qtqs0CMpeX+VWvi1PlVOkexwoon1M9jTrZVyAih6Ng3aERR+cYw8u3GhA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ce5VOHEr; 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.36 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ce5VOHEr; 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: 350F219B41 X-Spam-Score: -9.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: +6iXXQ3DorBx Hi, On Sat, 26 Mar 2022 at 20:33, kiasoc5@tutanota.com wrote: > Just so I understand, in other (imperative) words: > > gcc-hardened-1 =3D gcc-hardened built with regular gcc > gcc-hardened-2 =3D gcc-hardened built with gcc-hardened-1 > n =3D 1 > while checksum(gcc-hardened-{n}) !=3D checksum(gcc-hardened-{n+1}): > =C2=A0=C2=A0 gcc-hardened-{n+1} =3D gcc-hardened built with gcc-hardened-= {n} > =C2=A0=C2=A0 n++ > define the new toolchain with gcc-hardened-{n+1} To be totally correct: binary gcc-hardened-1 =3D source gcc-hardened built with binary gcc binary gcc-hardened-2 =3D source gcc-hardened built with binary gcc-hardene= d-1 where =E2=80=99binary gcc=E2=80=99 is the binary seed of the bootstrap. >> 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. >> > Thanks, are there any examples in the code base that would be a good > reference? (gnu packages commencement), I guess. On Sat, 26 Mar 2022 at 23:02, kiasoc5@tutanota.com wrote: > Here's a smaller example that has the same error: > > =3D=3D=3Dthe file=3D=3D=3D > (use-modules (gnu) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = (guix) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = (guix packages)) > > (use-package-modules gcc base commencement) > > (package-with-c-toolchain gcc `(("toolchain" ,(make-gcc-toolchain gcc)))) > =3D=3D=3Dthe file=3D=3D=3D [...] > The gcc package already exists! Why can't I build gcc with itself? Well, the symbol =E2=80=99gcc=E2=80=99 can refer to 3 things: - source - recipe for building the source - binary =20 Maybe I misunderstand you, but it appears to me that you want: binary1 =3D recipe built with binary0 but because =E2=80=99package-with-c-toolchain=E2=80=99 is recursive, it rea= ds, instead: binary0 =3D recipe built with binary0 so, it is a cycle. You cannot build binary0 using this very same binary0. Therefore, you have to tweak and manually write the chain, i.e., unroll the cycle. For example, gcc-hardened-boot build with gcc (seed), then gcc-hardened built with gcc-hardened-boot. Once you have this binary gcc-hardened, you can use it with package-with-c-toolchain; however, not for rebuilding gcc-hardened-boot or gcc-hardened, otherwise you are introducing a cycle. Hope that helps. Cheers, simon