From patchwork Thu Mar 20 20:54:43 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: 40527 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 611EE27BBEB; Thu, 20 Mar 2025 20:58:16 +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 3B97527BBE9 for ; Thu, 20 Mar 2025 20:58:16 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvMxu-00037R-Nq; Thu, 20 Mar 2025 16:58:11 -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 1tvMxs-00034j-2q for guix-patches@gnu.org; Thu, 20 Mar 2025 16:58:08 -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 1tvMxr-0002oJ-KP for guix-patches@gnu.org; Thu, 20 Mar 2025 16:58: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=s48JGBS7+1eAYxbQMZkgTk7NEwh17Swmtw6Ux+K/rLQ=; b=V9HYgjAsKwkzuTIzCNgI6rg79oyKv0FLF1bo4ASGM9EjZtZUOXhIs86+cAR0V+MEaibZBJQ1VbuhgP6QAU3+bQU94U6pqDkru+KE0xSjq9m7BJ6HooqHARfwZ7cMkYF0n/M6nC0Dj+5KKd7m6l1uEHDuMRHMcsXJeY7dY60ABqhXC/yC9ZdnXPPqxeciyzBd14p8WQOQK+9hUtUkHMPIbqx45HDs61a/9sTS3uznmmcSW22NisiW6yguS3lhoP1alWHfv9Y5tJqS3QX3Z4xLQ8Ug1m83Nwp2heQBnTWhTfOp87YW+fVXt6NhzYIanlcoyhTsI7PiFeFahIPm7asrag==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvMxr-0006gV-FA for guix-patches@gnu.org; Thu, 20 Mar 2025 16:58:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75810] [PATCH v7 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: Thu, 20 Mar 2025 20:58:07 +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.174250425225439 (code B ref 75810); Thu, 20 Mar 2025 20:58:07 +0000 Received: (at 75810) by debbugs.gnu.org; 20 Mar 2025 20:57:32 +0000 Received: from localhost ([127.0.0.1]:59205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvMxF-0006bn-P3 for submit@debbugs.gnu.org; Thu, 20 Mar 2025 16:57:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43258) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvMwE-0006SE-Pr for 75810@debbugs.gnu.org; Thu, 20 Mar 2025 16:56:29 -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 1tvMw9-0001HX-0I; Thu, 20 Mar 2025 16:56:21 -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=s48JGBS7+1eAYxbQMZkgTk7NEwh17Swmtw6Ux+K/rLQ=; b=jofrqaIlcnE0qa/Wdx9w Pk5rZFUUnlnv7jh759fKfrteiU8+/3PW5taUW4+QmwimtAaDQrWHFuuk5ry8XgCiBnXN8YJG183DT WYQx8d9VM4cWKHXRSokrXfECVQJMqHGZBK7B1tGrC9ulSy95CFrLnPiBjWgM5EvzF+J/8hTRQ2oUC kpDJRuY0rjn5LVKVp+B4RXU+UmUs0uUaFiY4JDkbRMyP00o8oZLhBA9iQoHOLbbcjcEXvslVPuJj/ +Oav9uClWkDcPzhZZ6AAt/lAWxzudcxt5eem5JU7B0bpn8D6E8I6SV6AxTQWXSS2gI3HPP3X01qb1 eNuFW0Kjc76rjQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 20 Mar 2025 21:54:43 +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 fa0f293aac..1733322316 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))