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 D42FE138359 for ; Fri, 30 Oct 2020 22:41:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E1562E0867; Fri, 30 Oct 2020 22:41:10 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BCA69E0867 for ; Fri, 30 Oct 2020 22:41:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D8C86340AB2 for ; Fri, 30 Oct 2020 22:41:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 04DCD430 for ; Fri, 30 Oct 2020 22:41:07 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1604097652.595ab9922f4ed8f88148ca7fbc9fe533db63fb4c.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 595ab9922f4ed8f88148ca7fbc9fe533db63fb4c X-VCS-Branch: master Date: Fri, 30 Oct 2020 22:41:07 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 64ffa3ff-53e2-4297-b799-f6d4d7a4ac3b X-Archives-Hash: d33df3d6d8c64ed0af444cd11b445812 commit: 595ab9922f4ed8f88148ca7fbc9fe533db63fb4c Author: Matt Turner gentoo org> AuthorDate: Thu Oct 29 14:39:35 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Fri Oct 30 22:40:52 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=595ab992 catalyst: Remove mount_safety_check() mount_safety_check() exists to prevent bad things from happening if a previous catalyst invocation left bind mounts active in the chroot. E.g., a previous catalyst invocation is interrupted without unmounting the bind mounts. A new catalyst invocation runs and cleans the old chroot, which inadvertently deletes files outside of the chroot via the bind mounts. With all the mounts now inside a namespace, it is no longer possible to have mounts accessible outside the build sequence. In fact, I think this code has been unnecessary since commit e5a53e42 ("catalyst: create namespaces for building"). Signed-off-by: Matt Turner gentoo.org> catalyst/base/stagebase.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index bd5ba8d0..b9c220d0 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -638,39 +638,7 @@ class StageBase(TargetBase, ClearBase, GenBase): assert self.settings[verify] == "blake2" self.settings.setdefault("gk_mainargs", []).append("--b2sum") - def mount_safety_check(self): - """ - Check and verify that none of our paths in mypath are mounted. We don't - want to clean up with things still mounted, and this allows us to check. - Returns 1 on ok, 0 on "something is still mounted" case. - """ - - if not os.path.exists(self.settings["chroot_path"]): - return - - log.debug('self.mount = %s', self.mount) - for x in [x for x in self.mount if self.mount[x]['enable']]: - target = normpath(self.settings['chroot_path'] + - self.mount[x]['target']) - log.debug('mount_safety_check() x = %s %s', x, target) - if not os.path.exists(target): - continue - - if ismount(target): - # Something is still mounted - try: - log.warning( - '%s is still mounted; performing auto-bind-umount...', target) - # Try to umount stuff ourselves - self.unbind() - if ismount(target): - raise CatalystError("Auto-unbind failed for " + target) - log.notice('Auto-unbind successful...') - except CatalystError: - raise CatalystError("Unable to auto-unbind " + target) - def unpack(self): - clst_unpack_hash = self.resume.get("unpack") # Set up all unpack info settings @@ -755,8 +723,6 @@ class StageBase(TargetBase, ClearBase, GenBase): % self.settings["source_path"]) if _unpack: - self.mount_safety_check() - if invalid_chroot: if "autoresume" in self.settings["options"]: log.notice( @@ -1363,9 +1329,6 @@ class StageBase(TargetBase, ClearBase, GenBase): def run(self): self.chroot_lock.write_lock() - # Check for mounts right away and abort if we cannot unmount them - self.mount_safety_check() - if "clear-autoresume" in self.settings["options"]: self.clear_autoresume() 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 97FCF1382C5 for ; Sat, 19 Dec 2020 19:56:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D4942E09A8; Sat, 19 Dec 2020 19:56:05 +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-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A8B68E09A5 for ; Sat, 19 Dec 2020 19:56:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D49E1340DA0 for ; Sat, 19 Dec 2020 19:56:04 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1ECE438A for ; Sat, 19 Dec 2020 19:56:02 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1604097652.595ab9922f4ed8f88148ca7fbc9fe533db63fb4c.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 595ab9922f4ed8f88148ca7fbc9fe533db63fb4c X-VCS-Branch: wip/mattst88 Date: Sat, 19 Dec 2020 19:56:02 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dce88a4b-9c93-4a3f-92ac-e61369160dd4 X-Archives-Hash: 36c6b62a532b84d1a70d3f9f7855f07d Message-ID: <20201219195602.7uGVAJpHSsAzKonbIFT6XabGv3a8Xgb1yDLT2fgYsec@z> commit: 595ab9922f4ed8f88148ca7fbc9fe533db63fb4c Author: Matt Turner gentoo org> AuthorDate: Thu Oct 29 14:39:35 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Fri Oct 30 22:40:52 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=595ab992 catalyst: Remove mount_safety_check() mount_safety_check() exists to prevent bad things from happening if a previous catalyst invocation left bind mounts active in the chroot. E.g., a previous catalyst invocation is interrupted without unmounting the bind mounts. A new catalyst invocation runs and cleans the old chroot, which inadvertently deletes files outside of the chroot via the bind mounts. With all the mounts now inside a namespace, it is no longer possible to have mounts accessible outside the build sequence. In fact, I think this code has been unnecessary since commit e5a53e42 ("catalyst: create namespaces for building"). Signed-off-by: Matt Turner gentoo.org> catalyst/base/stagebase.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index bd5ba8d0..b9c220d0 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -638,39 +638,7 @@ class StageBase(TargetBase, ClearBase, GenBase): assert self.settings[verify] == "blake2" self.settings.setdefault("gk_mainargs", []).append("--b2sum") - def mount_safety_check(self): - """ - Check and verify that none of our paths in mypath are mounted. We don't - want to clean up with things still mounted, and this allows us to check. - Returns 1 on ok, 0 on "something is still mounted" case. - """ - - if not os.path.exists(self.settings["chroot_path"]): - return - - log.debug('self.mount = %s', self.mount) - for x in [x for x in self.mount if self.mount[x]['enable']]: - target = normpath(self.settings['chroot_path'] + - self.mount[x]['target']) - log.debug('mount_safety_check() x = %s %s', x, target) - if not os.path.exists(target): - continue - - if ismount(target): - # Something is still mounted - try: - log.warning( - '%s is still mounted; performing auto-bind-umount...', target) - # Try to umount stuff ourselves - self.unbind() - if ismount(target): - raise CatalystError("Auto-unbind failed for " + target) - log.notice('Auto-unbind successful...') - except CatalystError: - raise CatalystError("Unable to auto-unbind " + target) - def unpack(self): - clst_unpack_hash = self.resume.get("unpack") # Set up all unpack info settings @@ -755,8 +723,6 @@ class StageBase(TargetBase, ClearBase, GenBase): % self.settings["source_path"]) if _unpack: - self.mount_safety_check() - if invalid_chroot: if "autoresume" in self.settings["options"]: log.notice( @@ -1363,9 +1329,6 @@ class StageBase(TargetBase, ClearBase, GenBase): def run(self): self.chroot_lock.write_lock() - # Check for mounts right away and abort if we cannot unmount them - self.mount_safety_check() - if "clear-autoresume" in self.settings["options"]: self.clear_autoresume()