From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CCzmNWItzWH+NwEAgWs5BA (envelope-from ) for ; Thu, 30 Dec 2021 04:54:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id GLU7M2ItzWFSXgEA9RJhRA (envelope-from ) for ; Thu, 30 Dec 2021 04:54:10 +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 1CCBD2ED2B for ; Thu, 30 Dec 2021 04:54:09 +0100 (CET) Received: from localhost ([::1]:46006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2mW0-0003WK-2u for larch@yhetil.org; Wed, 29 Dec 2021 22:54:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2mVu-0003W8-RJ for guix-patches@gnu.org; Wed, 29 Dec 2021 22:54:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2mVu-0002ae-IH for guix-patches@gnu.org; Wed, 29 Dec 2021 22:54:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2mVu-00081t-Gk for guix-patches@gnu.org; Wed, 29 Dec 2021 22:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52887] [PATCH staging] containers: Add CLONE_NEWCGROUP cgroup namespace support Resent-From: Ryan Sundberg Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Dec 2021 03:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52887 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52887@debbugs.gnu.org Cc: Ryan Sundberg X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164083638430776 (code B ref -1); Thu, 30 Dec 2021 03:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 Dec 2021 03:53:04 +0000 Received: from localhost ([127.0.0.1]:50842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2mUy-00080K-8v for submit@debbugs.gnu.org; Wed, 29 Dec 2021 22:53:04 -0500 Received: from lists.gnu.org ([209.51.188.17]:47662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2mUw-000802-NU for submit@debbugs.gnu.org; Wed, 29 Dec 2021 22:53:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2mUv-0003UD-RA for guix-patches@gnu.org; Wed, 29 Dec 2021 22:53:01 -0500 Received: from mail.arctype.co ([138.68.9.245]:42661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2mUt-0001CQ-Ou for guix-patches@gnu.org; Wed, 29 Dec 2021 22:53:01 -0500 Received: from authenticated-user (mail.arctype.co [138.68.9.245]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.arctype.co (Postfix) with ESMTPSA id 70F4913B22C; Thu, 30 Dec 2021 03:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=arctype.co; s=mail; t=1640836346; bh=eo3JTf1A4eSXvlGbTeDy0wnQmd5ETyyyakDjxJUTIUE=; h=From:To:Cc:Subject:Date:From; b=O6qD6HdvfYgE2CSqdZ24QVYcvSvT2s9AbpUnJDHaVq2aSjXa9f8k2p+mXufk5ecu5 UfEJFIiCq6Ukp1G4VD4i1mFWhvuiCugOmylWU7yfqWnV4OraQMGylbbijKwueCsM8i VJnegW3WUpf5nWa5IHmuaS/GM4FJ0xvtigmM/UeUYFipcduMjAjiTkrAA05EHHgI5k jn33fghLE5d2eWY7+c8dgvXSdcgr5PLtH6BliV5o8v/iN7s8IlR2HGT3FmUileLAsU eFfVbL4836nD+JHm3vVuufE/A5Ea+ABpuQqVYd+juPo51eUK5KtFk9flOPF/J4uumN YaIC/1bHjIRRw== Date: Wed, 29 Dec 2021 19:52:16 -0800 Message-Id: <20211230035215.14477-1-ryan@arctype.co> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=138.68.9.245; envelope-from=ryan@arctype.co; helo=mail.arctype.co X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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" Reply-to: Ryan Sundberg X-ACL-Warn: , Ryan Sundberg via Guix-patches From: Ryan Sundberg via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640836450; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=I4wnBXCDyUKtwUi5FDovwjSZioRStTVdEV3tQpjx8bE=; b=ZePgyfgEd5mERGMu24G8xrsknHdeuVNCEGYwt6UFIc/e7A/8fhEQmqnf1LkBI5wV4xg24+ Sj+iPu0MLp3FDp1sWUvr63dIZFQUMAao6IHFXfOr/JKNKTWIkJCVLufRjSguVVeKwrtUca /jGcVvezbTcNwGqnvnLSjQUP8h72ovG3NqBcwk16RltGt1MBXAXhIs5TdzvUloOGd+CJGG wCiiuQ2YGPFxHqQcDp0pHuAt/G2pSd72OwtcLyS6mTfr0CxJ1PSCx6mFoZp3h0KuRsEqM1 JwfMXcY9b5nhuBRSjPbkJ9kuPqTPJM3JDVrrPnsjy5d1i8OUrlGY51G2MSIsIw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640836450; a=rsa-sha256; cv=none; b=W5ws+DL7Xb8dzzsm7Bus8Cuzo2aO7RpG3hFbUocXqA/9wBc+po34033CksJ5MChOZ9hRDf r55rOk8rWpkb7DSnriBOJbRnAjU7T5hQVZ8GNtv5qO4pZf4Z8LcFEPCyJsBlXB6xq6Ya/7 HuWkhHRM57nJ3o8+Je/xQPOj39RIcjwAJKwajRtjY7FER7uBYtqX9LlUCxqbtIHFdohmuz mY46o4EsjQQ0tJKTdZVhg7MYIPMAf9atSDeGRYDZfB2YK3/xl0QovQ3ysG6FNTwL7g/n2C nPQZwLfSOUoVJm9EaZ2vwM+VyJ8GPOAcNK7f5O9fm1ezGPQgvB3oe3iK+AnROA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=arctype.co header.s=mail header.b=O6qD6Hdv; 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.27 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=arctype.co header.s=mail header.b=O6qD6Hdv; 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: 1CCBD2ED2B X-Spam-Score: -3.27 X-Migadu-Scanner: scn1.migadu.com X-TUID: +TZcXa8tj9/V Adds low-level support for launching linux containers with cgroup namespaces. gnu/build/linux-container.scm (%namespaces): Add 'cgroup guix/build/syscalls.scm (CLONE_NEWCGROUP): Add flag definition --- gnu/build/linux-container.scm | 3 ++- guix/build/syscalls.scm | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index 4a8bed5a9a..bdeca2cdb9 100644 --- a/gnu/build/linux-container.scm +++ b/gnu/build/linux-container.scm @@ -52,7 +52,7 @@ exists." (file-exists? "/proc/self/setgroups")) (define %namespaces - '(mnt pid ipc uts user net)) + '(cgroup mnt pid ipc uts user net)) (define (call-with-clean-exit thunk) "Apply THUNK, but exit with a status code of 1 if it fails." @@ -210,6 +210,7 @@ corresponds to the symbols in NAMESPACES." ;; Use the same flags as fork(3) in addition to the namespace flags. (apply logior SIGCHLD (map (match-lambda + ('cgroup CLONE_NEWCGROUP) ('mnt CLONE_NEWNS) ('uts CLONE_NEWUTS) ('ipc CLONE_NEWIPC) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 45f95c509d..a7401fd73f 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -132,6 +132,7 @@ CLONE_CHILD_CLEARTID CLONE_CHILD_SETTID + CLONE_NEWCGROUP CLONE_NEWNS CLONE_NEWUTS CLONE_NEWIPC @@ -1025,6 +1026,7 @@ caller lacks root privileges." ;; Linux clone flags, from linux/sched.h (define CLONE_CHILD_CLEARTID #x00200000) (define CLONE_CHILD_SETTID #x01000000) +(define CLONE_NEWCGROUP #x02000000) (define CLONE_NEWNS #x00020000) (define CLONE_NEWUTS #x04000000) (define CLONE_NEWIPC #x08000000) -- 2.31.1