From patchwork Fri Mar 14 17:48:06 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: 40178 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 D4A2B27BBE9; Fri, 14 Mar 2025 17:51:52 +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=unavailable 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 B421A27BBE2 for ; Fri, 14 Mar 2025 17:51:52 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tt9C3-0005pV-RH; Fri, 14 Mar 2025 13:51:35 -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 1tt9Bd-0005JX-8z for guix-patches@gnu.org; Fri, 14 Mar 2025 13:51:09 -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 1tt9BY-0002HL-KI for guix-patches@gnu.org; Fri, 14 Mar 2025 13:51:07 -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=3+xXW3NEhqCdaNvzOdWk4oL/UxHf2EzI+PwkPo6SGtE=; b=SZk9o4J5eE2RuXvEGV+pJTWvWYTf5g0r1/5whJDvrvEkvhwaUfDHbFLXgMMMi9LPZFQSGLzNm/+4+B6Y4y/VzJCEIm+ccDhHY84b84hMGhnFsbaVXbeYmfqGBN7YYueSIbOOFRtgaa3TxGfZGCJu60ySDc+DyB8LMMptke5/VsPxtGRPYGF46C0GTLlZKZeG86KM8Omyq3lRpzUVRx8tncFElHtIhT9nFE9yhTKMSLL9x5bcIDBWmccUB0opxFT+HkRfA2trS+HM+Da2mqdoF/1Am4vUTAAbTa1/qOlsXRPH3+AQOy9NQtGV5VaIxT67esAwD5BsvAVEeCUAMiWqVg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tt9BX-0004ao-CQ for guix-patches@gnu.org; Fri, 14 Mar 2025 13:51:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75810] [PATCH v5 09/14] 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: Fri, 14 Mar 2025 17:51:03 +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.174197461517319 (code B ref 75810); Fri, 14 Mar 2025 17:51:03 +0000 Received: (at 75810) by debbugs.gnu.org; 14 Mar 2025 17:50:15 +0000 Received: from localhost ([127.0.0.1]:36046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tt9Ak-0004Uu-Cq for submit@debbugs.gnu.org; Fri, 14 Mar 2025 13:50:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34836) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tt9AT-0004PX-1R for 75810@debbugs.gnu.org; Fri, 14 Mar 2025 13:49:57 -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 1tt9AM-0001z4-Ak; Fri, 14 Mar 2025 13:49:50 -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=3+xXW3NEhqCdaNvzOdWk4oL/UxHf2EzI+PwkPo6SGtE=; b=eQxUXS67BLShE3pn4tPG DEVTyJnPN/cg6vA+vqhbiB/t9KFiHqD1HFjPMJCoeOglfNMBErniN4mjd92C3DenRimjEPhnEq4Pu WHRK78gtKZYGtlwKLgvOK6Gnm4RLswZjv2bUn+bQIy5/0ER04PXNtqOoMoxarWR40Mae+ohudbAId ORvDh4buu1s0AEEAWHyGBS0iLHemw0w37Zkqy9+TsGvE7t18bkGIzScGZl00bkCSaEsJ0n/Y5Ton9 kTWqQQvZV4I6GxuvUw+xpYmRDLvthpWY+rCRJRv4Gx6Zkto7A0W6F7N9SoUCmWH8nuU6RrmGgq7xQ 6cCiqs2Iw0NMSQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 14 Mar 2025 18:48:06 +0100 Message-ID: <86a4ed49616acee6bf2767470f76d459000f4ca3.1741973869.git.ludo@gnu.org> 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 07c8ad7e1d..37c3d3bf1e 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))