From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 5014A803F6 for ; Mon, 16 Nov 2026 06:14:27 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AG6D8j3020463; Mon, 16 Nov 2026 09:13:09 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AG6D8j3020463 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="uRm9gBeu" Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AG6D7o3020455 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 16 Nov 2026 09:13:07 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AG6D7o3020455 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48c6a1d4034so1994486f8f.0 for ; Sun, 15 Nov 2026 22:13:07 -0800 (PST) X-Gm-Message-State: APuU4Z8QHTgWqaIwGkIz9tAhexbcbrPPq8MpBjjV3lqEDyAxlKf/8ce1 QCCeJ2P9SPQubGjRW1V8a7VHQ9RY8XwRy5pBG6vpBYB5PnnKTriiGDFF6Aajx6Rmczq/EDh3Yxs R7HbbNHQq81326HyXrnZf1zFdKZLUflHpH539wxqLnkl21goKVKZmKg== X-Gm-Gg: AYBFou1u35wNUdb5ZwRDgDFjzW/FYE1jAaTViDUw9nOr3iGBgqaO7ldXvsSU37cnJum Ni8E5kLdHvoojKdpkHZxGMt6ZWUAgz6zWEal9PRSg6G28cO0d1jgAYq9WFpOaS2QtUfPlxASRCG 73I/2eHjMxOKcQhiLEZeQ+m2LlUjjNd05lrGbga6EGXbr/ycs9vZMN9Req3C5wJjMTWrP9Tr5c2 q/8G2kxj3Tz2jLtNsqrjNbi2tfw4ioxXII0OYRCY2uNaq6elg8Wtqi+CrxAi1OfWpVaYWsLBNqh jCegsMJjdXT/IckoUd0a85N7SfOO5dDltCf34kh8X8ll6mPMy65nz3PSZOpa+EpneZ1P1ZsnS6D YjwJuUXmbL44M7XXg1gmG/4ey29r/Zw== X-Received: by 2002:a05:6000:4690:b0:49b:b93d:91f1 with SMTP id ffacd0b85a97d-49ee20353c9mr6457419f8f.25.1794809587496; Sun, 15 Nov 2026 22:13:07 -0800 (PST) X-Received: by 2002:a05:6000:4690:b0:49b:b93d:91f1 with SMTP id ffacd0b85a97d-49ee20353c9mr6457397f8f.25.1794809587019; Sun, 15 Nov 2026 22:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794809587; cv=none; d=google.com; s=arc-20260327; b=DsQ8AZzdctdVSC57cwyMxVnwgFwCbxlWepvbx2lmkKJJXNg4UJsU3+g8cWw3SXBZ03 xF0G6vEo1SJ+nPHjaucmPQXBRamrTWm5SdVtb8xsEtJghmInbeZ38ItIGy9Jc9+dxkF6 sdZE7knJJHiPiBFj7Xm3aTXDuUOahD1etJZXRpWgECJcTl727bSeRi9JTMVYhBjnrnJ4 H2WrabVIfbupCGOl9Ckx2aSmlfy0P2iRcm/GTIHFPv0+dAeDcXgoiFDYJQOnQVJBq9uv 4sNggy+MD/TGZnc/1dPMHqeI6zuB7t1O2fa72puBtq2H+nT/st7sfeaTuQmwn+4H0ChL /DOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=hZUlIJOwfb4bW3Ae9tYIRQeQ51waHJSCgSSTsKyv81M=; fh=wpoNUURlquLpJK/14Kny0oMIYkY7mYwjJ/Ils9UT2kk=; b=Jm3pRwokI4DW1mMZpsV7oGpN76LZ8KjJEuO0TYnxWArNrAu2iCOEUZRf9OIaOoIajV /PKFjbTFy9XQZRSizzVZTvmhH5wJI/lRCv5d69oc0PQHVyuAnnnTbMF2nbtzxCD6k8eK XYhwjY8ON4P68N/4Dg5WQWmkZa9nwg8z3hFWl2k4Sdui2RcRgVTZg7NlfblovwF0PlIT 5dvapRcmvL1ZDd6ZWa7fEYUc6tki/q0EX5MxhVNgScycJI7o4VGf6t22b7vCAvy018pl 48R0qvZbRRsc8xizSRQGU27BJI972b1bWI0TryZwqkTGnxqjwsWpNhIQJ3f204SJEOUf dunA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=uRm9gBeu; spf=pass (google.com: domain of mirian.shilakadze@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=mirian.shilakadze@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-49c63122563si18909907f8f.96.2026.11.15.22.13.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2026 22:13:06 -0800 (PST) Received-SPF: pass (google.com: domain of mirian.shilakadze@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=uRm9gBeu; spf=pass (google.com: domain of mirian.shilakadze@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=mirian.shilakadze@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=hZUlIJOwfb4bW3Ae9tYIRQeQ51waHJSCgSSTsKyv81M=; b=uRm9gBeuf9RN YPMbMB318/evepxzag8MtHoP/6bRAMlOzFHlyWlwhsqUG2/c3hm+hbmH61iNNLO+GkBXMETdWnnsS 3eDdo50GoE+h7O4BSaeUhAjdQnqZLPGNw7W9Xajgn9e4ok1Q1arcYLsX+kV5l89Mo84loNzvgJten nqQrXrlxolzaORErGxqGzta7YLwEotjUaTq71o+WyX+EAFioaWv/0QWi/3nIa9sRoaGO1d89KFWwe YeAjzISkuPc2ievEZZsEPna0SJdiqvpcLW6LSR7t2ddxczmmHoDwPTqIegFabAi0OrgyH8LSb9iy2 sTE2sEzVGGzx9olqjmVjSQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=localhost.localdomain) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xSptT-00Cj8x-2w; Mon, 16 Nov 2026 07:12:58 +0100 From: Mirian Shilakadze To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com Date: Mon, 16 Nov 2026 10:12:51 +0400 Message-ID: <20261116061256.54472-1-mirian.shilakadze@virtuozzo.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH vz10 v2 0/3] fs: let the host lock the protection flags of a mount X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org A container can strip ro, nosuid, nodev or noexec from a bind mount the host gave it with "mount -o remount,rw,bind" and then write host data. This series lets the host lock those flags on a mount, reports the locks in statmount() so that criu can carry them over a checkpoint and restore, and tests both. Changes since v1, after Pavel's review and Sashiko's: - one attribute per protection, MOUNT_ATTR_VE_LOCK_RDONLY, _NOSUID, _NODEV and _NOEXEC, with MOUNT_ATTR_VE_LOCK as the mask of the four, so a lock state that is read back can be set again exactly - a protection lock can no longer be dropped, attr_clr refuses it, as nothing drops the locks lock_mnt_tree() raises - the gate is capable(CAP_SYS_ADMIN) alone, ve_may_lock_mount() is gone - one mount per call, a lock with AT_RECURSIVE is refused - do_remount() tests the locks under s_umount before it touches the superblock, and mount_setattr() holds s_umount for read while it locks. v1 could return EPERM with the superblock already changed. - lock_mnt_tree() and the perf header copy are left as they are - new: patch 2, statmount() reports the locks - new: patch 3, the selftest Pavel's other suggestion, a lock that keeps the container from unmounting or moving the mount, is a separate series on top of this one (VSTOR-154914). The vzctl and criu sides go to their repos separately. Tested on a VHI node with the 22.22 release kernel plus this series: - ve_mount_lock_test 8/8 (2/8 on the stock kernel, which lacks the feature), mount_setattr 21/21, statmount 15/15 and statmount_ns 2/2, the same as on the stock kernel - a container started by the current vzctl: without a lock it can still remount its read-only bind mount rw. Once the host locks the mount in the container's mount namespace, the remount fails with EPERM and a write with EROFS, while umount still works. Suspend and resume work, the current criu restores the mount unlocked. https://virtuozzo.atlassian.net/browse/VSTOR-155305 Mirian Shilakadze (3): fs: let the protection flags of a mount be locked from userspace fs: report the locks of a mount in statmount() selftests/ve: test locking a mount from the host fs/namespace.c | 67 ++++- include/uapi/linux/mount.h | 15 + tools/testing/selftests/ve/.gitignore | 1 + tools/testing/selftests/ve/Makefile | 1 + .../testing/selftests/ve/ve_mount_lock_test.c | 274 ++++++++++++++++++ 5 files changed, 352 insertions(+), 6 deletions(-) create mode 100644 tools/testing/selftests/ve/ve_mount_lock_test.c -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel