From patchwork Sun Mar 23 14:25:03 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: 40741 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 9E26027BBEA; Sun, 23 Mar 2025 14:27:02 +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,URIBL_BLOCKED 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 4559727BBE2 for ; Sun, 23 Mar 2025 14:27:02 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1twMHN-00033f-HG; Sun, 23 Mar 2025 10:26:21 -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 1twMHK-00032D-0N for guix-patches@gnu.org; Sun, 23 Mar 2025 10:26:18 -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 1twMHJ-0005W1-Np for guix-patches@gnu.org; Sun, 23 Mar 2025 10:26:17 -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=ebgNbSiSau1G/26jNpSDxHX+Q5HhMImSR1l/nH8CqFI=; b=sTJRD/qw+VMiVq7kuCqwSKxbmQDzbAuH+veMzWw8dI+h31W322e6Ab/+i/P1mkTOwnT1PmuHGViSwOn/oq1LGyjBITc+rNpR9pmmodsBwpGILD6WgT+RE+PYVmtnkvvzW6YMW2BLi8T/l0HvFUXxxxmGQI8rD+XwYKe6krts3xvTpZO1os/XMpGvCNWE3TeA5+Om9LaG03NEShW5ouKvW0BAmTnV+nOMxT1t4YFH3PZG22+Kmta0/B5rFqRTpTTAzjP9kFm6JbF8YGNIy6gPsligWSlT/vcf4K7GOHveq2kwTR683nMsRkJyAinN8dbjoStcYZ/mfmYGFW5xUIRtNQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1twMHJ-0005Z7-H8 for guix-patches@gnu.org; Sun, 23 Mar 2025 10:26:17 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75810] [PATCH v8 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: Sun, 23 Mar 2025 14:26:17 +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.174273997421346 (code B ref 75810); Sun, 23 Mar 2025 14:26:17 +0000 Received: (at 75810) by debbugs.gnu.org; 23 Mar 2025 14:26:14 +0000 Received: from localhost ([127.0.0.1]:51891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1twMHF-0005Y1-Aj for submit@debbugs.gnu.org; Sun, 23 Mar 2025 10:26:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41150) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1twMGs-0005ST-8W for 75810@debbugs.gnu.org; Sun, 23 Mar 2025 10:25:51 -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 1twMGm-0005T7-Ss; Sun, 23 Mar 2025 10:25:44 -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=ebgNbSiSau1G/26jNpSDxHX+Q5HhMImSR1l/nH8CqFI=; b=lh3YUwIA3A7sMrLqqaAo KYdhu1mMFJRo3m/nEnnHkCun4sAK7G8RMGaG072xgKQ0feWPE1gJi7DLZcmDsT0hXze2Dp3+bppGN JSs6++jE1IhdjNxKIoGPDomA5QrM0KY4YENrl+3jTcl20/o3AREpYTKuTFqMYbIgMCJ2oD35XfSSM PhrloEAy0dZDXM7Jh0GGgtNWW2M4ciKLqJ1SeStzyCODu7qL7GgcrQoxWbjQi5N+RgJDdR0axTK// X4Us9G+/VVBv0JhETcP9JGaikijhYyE7jWwqWyo1vaurZs7ejNWBUMQcjx+PaP+PMuulslKlKrzZ8 4nPiTfsKrpf/eA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 23 Mar 2025 15:25:03 +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 e6a139eb0d..d0fcc99854 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))