From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7432D139694 for ; Tue, 14 Mar 2017 20:52:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8F38FE0CB9; Tue, 14 Mar 2017 20:52:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6B7D3E0CB9 for ; Tue, 14 Mar 2017 20:52:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1F88333E142 for ; Tue, 14 Mar 2017 20:52:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 85E22684B for ; Tue, 14 Mar 2017 20:52:50 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1489269687.e5a53e42022668563965ede6409a3de233af332c.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/main.py X-VCS-Directories: catalyst/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: e5a53e42022668563965ede6409a3de233af332c X-VCS-Branch: master Date: Tue, 14 Mar 2017 20:52:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9abe27c6-aa26-4c6a-a1f5-66fec31fdac0 X-Archives-Hash: 6d3ec6ca951d82681726856dfd2449af commit: e5a53e42022668563965ede6409a3de233af332c Author: Mike Frysinger gentoo org> AuthorDate: Tue Oct 6 20:32:03 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sat Mar 11 22:01:27 2017 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e5a53e42 catalyst: create namespaces for building This helps isolate the catalyst builds from the rest of the system and allows us to build as non-root user in more cases. We don't support pid or user namespaces yet. catalyst/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/catalyst/main.py b/catalyst/main.py index 51d2b04..b8ae662 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -12,6 +12,7 @@ import os import sys from snakeoil import process +from snakeoil.process import namespaces from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS, CONTENTS_DEFINITIONS) @@ -421,6 +422,14 @@ def _main(parser, opts): # catalyst cannot be run as a normal user due to chroots, mounts, etc log.critical('This script requires root privileges to operate') + # Start off by creating unique namespaces to run in. Would be nice to + # use pid & user namespaces, but snakeoil's namespace module has signal + # transfer issues (CTRL+C doesn't propagate), and user namespaces need + # more work due to Gentoo build process (uses sudo/root/portage). + namespaces.simple_unshare( + mount=True, uts=True, ipc=True, pid=False, net=False, user=False, + hostname='catalyst') + # everything is setup, so the build is a go try: success = build_target(addlargs)