From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wO2qM5RoLmJDTQEAgWs5BA (envelope-from ) for ; Sun, 13 Mar 2022 22:56:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sEJVMJRoLmKeMAEAauVa8A (envelope-from ) for ; Sun, 13 Mar 2022 22:56:36 +0100 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 6790B3FAFF for ; Sun, 13 Mar 2022 22:56:36 +0100 (CET) Received: from localhost ([::1]:45892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTWCZ-0002FI-Ji for larch@yhetil.org; Sun, 13 Mar 2022 17:56:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTWC2-0002CL-Ut for guix-patches@gnu.org; Sun, 13 Mar 2022 17:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTWC2-0007TG-Mj for guix-patches@gnu.org; Sun, 13 Mar 2022 17:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nTWC2-0007rY-ME for guix-patches@gnu.org; Sun, 13 Mar 2022 17:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54377] [PATCH 2/3] linux-container: Add #:guest-uid and #:guest-gid to 'eval/container'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Mar 2022 21:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54377 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54377@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 54377-submit@debbugs.gnu.org id=B54377.164720851130146 (code B ref 54377); Sun, 13 Mar 2022 21:56:02 +0000 Received: (at 54377) by debbugs.gnu.org; 13 Mar 2022 21:55:11 +0000 Received: from localhost ([127.0.0.1]:43468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTWBC-0007q9-TA for submit@debbugs.gnu.org; Sun, 13 Mar 2022 17:55:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTWB9-0007pO-73 for 54377@debbugs.gnu.org; Sun, 13 Mar 2022 17:55:07 -0400 Received: from [2001:470:142:3::e] (port=34776 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTWB3-00079a-T6; Sun, 13 Mar 2022 17:55:01 -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=9+tFWJSQvSObmGAVOflTp472fIIrYqU8MzHz1aYfnyw=; b=my/x0ZgIIORku8KUYoGe H8VmB4Alvv13SfBoo1/4qMP0yMfniHQhCEIlBDwCXHNmCFElJ2zxnnV9mKnTCkFb8UpYGNm9xeRps 36C/MFYtRUipH1zV8yL+UV8kaokI6Mpx6acYFaLwdgjX96WC68EtGnfLT8dq89jKdtQLMwHmEz2Jv NrWifjwcGEG/SyuQyTZGRXv2fir2atGz60mFU1rOFO/Qed/4bsxA1BFM8ZaNDw0w4mKokrDFGE8ha L8nxokVk7AGgB3th8TjRO6k9/R/VWSOmd+8w8OMDA7wJ4JCe1lstOkW+L7U/56E8honOHfpX4N0xV rTQo/rSyvbgu9A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:62695 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTWB3-0003Co-FS; Sun, 13 Mar 2022 17:55:01 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sun, 13 Mar 2022 22:54:53 +0100 Message-Id: <20220313215454.9576-2-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220313215454.9576-1-ludo@gnu.org> References: <20220313215454.9576-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" 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=1647208596; 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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=9+tFWJSQvSObmGAVOflTp472fIIrYqU8MzHz1aYfnyw=; b=g07jD5UlI3jBCLvMg2r64HxeQ5gDAKEIu3DdQA5LQUHJOlbQWVH+wep7zvydwcDRmc1r5s /p6QJ6taImyHgLaq2lzYuZdjweCDYib5bTp+NDDYjiIwer42ZDUPOJrnZK5Gba5biCf1iE NsQdz1wq7Y/CxpbJFruM+veUE9zC9PHM5kv12ww0niOkNa/R/WOXiKM5IBbJnDCZRXsTBP 0QJMdEejruCxEqED4cRtAb3rqq8SYcBMTMBIW3cJpSqD0rZjnOQGYwTJkPwqpGGuIwF0HM gm1VbwtHXoK1eIBvOiDg0dvTxUWFnmWf9WJpY+UW0ihtpXC8bi++HrjL0Gufcw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647208596; a=rsa-sha256; cv=none; b=XucH0LzVGAfaox8slba/OgrVcptYnUvLK28NuhZp85UvseTgIfMCk3Kfrt8WvirAb9St8/ URo3OvQB6a0mNnqPfwyXyCHPJ4WruSbsXoxJ0V1JFypkez9qDC5luQsh+Zm9bmlsd6WSI+ YSXUyCg64As1ixYQP674HxqVyXrDFr2S1Qu1sT93QjzJu50tSG8s1MI7h2pdugveO9trKo MISYRyfE0Uyk/HrCtLCLAFpFH0wGdMe/7sREXkXVoJ4yqvZPdVqx2EwiGn4TavBbQtTUFY Ps+tsjeC6n6PLwWRJUWTPxbCImV6iSi3wesk1EZxhkN/mHAoVjB/5FrGUUlg2g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="my/x0ZgI"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.67 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="my/x0ZgI"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 6790B3FAFF X-Spam-Score: -3.67 X-Migadu-Scanner: scn0.migadu.com X-TUID: +VFuKuH5eUYM * gnu/system/linux-container.scm (eval/container): Add #:guest-uid and #:guest-gid and honor them. --- gnu/system/linux-container.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 415d6b9775..eeb0f68c02 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson -;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2016-2017, 2019-2022 Ludovic Courtès ;;; Copyright © 2019 Arun Isaac ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2020 Google LLC @@ -248,11 +248,13 @@ (define (explain pid) (define* (eval/container exp #:key (mappings '()) - (namespaces %namespaces)) + (namespaces %namespaces) + (guest-uid 0) (guest-gid 0)) "Evaluate EXP, a gexp, in a new process executing in separate namespaces as listed in NAMESPACES. Add MAPPINGS, a list of , to the -set of directories visible in the process's mount namespace. Return the -process' exit status as a monadic value. +set of directories visible in the process's mount namespace. Inside the +namespaces, run code as GUEST-UID and GUEST-GID. Return the process' exit +status as a monadic value. This is useful to implement processes that, unlike derivations, are not entirely pure and need to access the outside world or to perform side @@ -292,4 +294,6 @@ (define items (list "-c" (object->string (lowered-gexp-sexp lowered)))))) - #:namespaces namespaces)))))) + #:namespaces namespaces + #:guest-uid guest-uid + #:guest-gid guest-gid)))))) -- 2.34.0