From patchwork Mon Mar 17 17:02:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40292 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 180F527BBEA; Mon, 17 Mar 2025 17:06:54 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CBA8127BBE2 for ; Mon, 17 Mar 2025 17:06:53 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuDu2-0005FX-4S; Mon, 17 Mar 2025 13:05:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuDtx-0005Cm-AW for guix-patches@gnu.org; Mon, 17 Mar 2025 13:05:21 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuDtw-0005ix-QX for guix-patches@gnu.org; Mon, 17 Mar 2025 13:05:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=UutMX9pAeYaOKM9If5j0ljEqrH6oIEE2IroKoS0wm4Q=; b=gJhh1QHDJvLgQWCpv1q6rOsPdo6EExDi/GJPXzaJrPJ8ZAvmkz5VPmSYb+3PaXONb7AAL1h1T9xvIIw3A8Eq/C+JsvD/FkciIXZE+uoT7/3RoKeIL+lyPaR1MqOL5l+dmK0+8Rhjqf7zzTqfsgm7NLRLqW1R2FbHVb+DSZTHG6Vud9UQ+1mjmLEGWfiZwENJBDFEZthMQci12u7i+OWhXmdItmc/qBCR9tI/4sdaXpsuBfHrpuzOUlcBz4bkR6dikikebNn6NUIzRjOkhUoVykQV9fg8NofSeB8Jk9RFqjQBHn8wrzPr91wUaApQP7EXC426KtZeQsH1UtebPVhIuQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tuDtw-0002u8-IW for guix-patches@gnu.org; Mon, 17 Mar 2025 13:05:20 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75810] [PATCH v6 10/16] daemon: Move comments where they belong. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Mar 2025 17:05:20 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75810 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75810@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 75810-submit@debbugs.gnu.org id=B75810.174223110510737 (code B ref 75810); Mon, 17 Mar 2025 17:05:20 +0000 Received: (at 75810) by debbugs.gnu.org; 17 Mar 2025 17:05:05 +0000 Received: from localhost ([127.0.0.1]:60681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tuDtg-0002mi-SU for submit@debbugs.gnu.org; Mon, 17 Mar 2025 13:05:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36070) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tuDtR-0002ib-Lu for 75810@debbugs.gnu.org; Mon, 17 Mar 2025 13:04:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuDtL-0005O6-8m; Mon, 17 Mar 2025 13:04:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=UutMX9pAeYaOKM9If5j0ljEqrH6oIEE2IroKoS0wm4Q=; b=IwYZ/Lce+2YicytLDwe8 sd+3dHW1Y7b6me3vQxN2qyjUZfuV19HVYpUDCjX0CITTe+0IaMUhaEuulPxSTeKjc+oQVpc8nSTOm U4Q0LRaZwtl66Jw2PqzGxbNZWPLYBenMiheNrm7ZdAllXri90OIzNu07DmrcVyXBzr6yXws5iNar2 NI+tuTYy7wLbKID3y/U2v2T9FazNMUy/a+57pYO7rKxkD+7eYGGgWpozKQUmb1kXdN3BBF2zAEKTY mNJzj94esVKNZUcjYVJ9AhPN/5h6ZDIFg3mjgw4rUdgV10UspsfZUiPrmQ1tLFeiy07NrQsQtVWJk LJDAmI0IB59xNg==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 17 Mar 2025 18:02:53 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * nix/libstore/build.cc (DerivationGoal::startBuilder): Shuffle comments for clarity. Change-Id: I6557c103ade4a3ab046354548ea193c68f8c9c05 --- nix/libstore/build.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index 51ac11e235..54d2996dd1 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc @@ -1870,18 +1870,19 @@ void DerivationGoal::startBuilder() } dirsInChroot[tmpDirInSandbox] = tmpDir; - /* Make the closure of the inputs available in the chroot, - rather than the whole store. This prevents any access - to undeclared dependencies. !!! As an extra security - precaution, make the fake store only writable by the - build user. */ + /* Create the fake store. */ Path chrootStoreDir = chrootRootDir + settings.nixStore; createDirs(chrootStoreDir); chmod_(chrootStoreDir, 01775); if (buildUser.enabled() && chown(chrootStoreDir.c_str(), 0, buildUser.getGID()) == -1) - throw SysError(format("cannot change ownership of ‘%1%’") % chrootStoreDir); + /* As an extra security precaution, make the fake store only + writable by the build user. */ + throw SysError(format("cannot change ownership of ‘%1%’") % chrootStoreDir); + /* Make the closure of the inputs available in the chroot, rather than + the whole store. This prevents any access to undeclared + dependencies. */ foreach (PathSet::iterator, i, inputPaths) { struct stat st; if (lstat(i->c_str(), &st))