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 C79228017D for ; Wed, 18 Nov 2026 10:38:35 +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 6AIAbMkY023433; Wed, 18 Nov 2026 13:37:23 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AIAbMkY023433 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="inm0PgYM" Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AIAb2OV023393 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 18 Nov 2026 13:37:02 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AIAb2OV023393 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-4a370217dcfso632451f8f.1 for ; Wed, 18 Nov 2026 02:37:02 -0800 (PST) X-Gm-Message-State: APuU4Z9B2CJVH3z4hpD9MBZoa8RFZRCXntktkrmWA+9c0a7Nk7/RR7Hj EBfAgl1RINSYKq8Vb5XeHiIn20/2FZyDXXadrZxsZ6+xX2xjtA66yCHbIXjI354A423gp5lkxxM JZmhFQQHd/IkUWvA2UD5cSre7dQ8IX3NJ11OnBkjT9gGxaLmgZlNeTA== X-Gm-Gg: AZFdTZdx6mZdiNFG0Wd3v5IwISQ1hZ8i0DnwFMPWb62sCmteg5d2aDn93HpzojerPIM f5f+nBljRs+y50m7Yn3Ig089sZsHpZ4Ezd/+c7kVBNu3gz1vfN+ACFWhCzFp2MplFEGpDmsPjLN Ik3d7kHTTx6QqzUK6hhzkxg1fHyJwRyvWK35v8FYlGlG6BgWisnwYrqyernS+Sx5FOHxesJdalR Eza11ukyaVTy2XN02apbPZe3jPPfX6Nf5/CcVhtQJKSmOrElb4PFXQVXl5F9BeEAmjkoofho/Ic 3FsaW/RgaZKhKDDM72EEBi4QWpMVqCKszh9Ws99ovof+xh38e6Is3QvHBZjV3JCouB+57KaVGii 3OwBXVlHtQ77/kKytG9uCITRD9RXV X-Received: by 2002:a05:6000:4555:b0:48d:f464:6989 with SMTP id ffacd0b85a97d-4a63b0434damr3280357f8f.27.1794998222247; Wed, 18 Nov 2026 02:37:02 -0800 (PST) X-Received: by 2002:a05:6000:4555:b0:48d:f464:6989 with SMTP id ffacd0b85a97d-4a63b0434damr3280340f8f.27.1794998221825; Wed, 18 Nov 2026 02:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794998221; cv=none; d=google.com; s=arc-20260327; b=fcEdmjBEt2RW1NYCQ4CvlQZXyCIStNAw0ON2lDz39eqzueC+/AfS2M7TbbFHJqcxFF ag4EFN0z4NLUwMXzN9rny/WrNXF/ox23Kmo2fn/2y0HOkTBYUm4qxNfJ/AgiMPdwX0vW TLg5SnFlu65y2ViwX0fjMlY9mEvCD6Wuy2AvsY6Cd0KqLbnNlL/N4i6YpgpTwRo+O7M0 u730KjU+pHWo/xjsnmRx8G1Ny+gmWFvLbus9V2bWHXtUncfYJHj3y6gvHZXiynU51/lR 3AcreKWlbIi6iq9Kr3xyBIEUryMWBFPNGgf+Dk/xLP3iU+ulYU2h1dNKsPVFffVpqyFM XmJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=K3pbTxWd69vawZgr8c6UsvrBiJN4lg1B0U1QTjsaIxM=; fh=wpoNUURlquLpJK/14Kny0oMIYkY7mYwjJ/Ils9UT2kk=; b=ilJFvt8lE7b3WX9yk0PPNsLieKu4qeAidEBMw+UvE1/lZO3C00NFJ+9p31mFzXKmjY BzbxamXhRnsnrNKTFlEF4A21u/eqqFEP4euDeKiccOFmEvj5ul/1xg/alY6z92mfvLRr 85u55uG5zavJStNinxhVO0xcHht4Pg12KH14bEeCGlqr4yArGvaIpBygWrSdGzfwkT/L ebhM2093aBHEzL4mAQZXa0oBs2U7HkCzGTGVtPy3cXF6y9skLa1GSz8WvNkIfjfmNu3G m6AEsM8o1WqblZFg4FKEF931u8lnKcI3n9ZcxKC4+sE1nX1Do+YYWxMMO0ged+rhLDeo BRnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=inm0PgYM; 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-4a65a0c5628si4317135f8f.353.2026.11.18.02.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 02:37:01 -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=inm0PgYM; 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=K3pbTxWd69vawZgr8c6UsvrBiJN4lg1B0U1QTjsaIxM=; b=inm0PgYM74nI EKQBRbz824FQzkdlpi8KRrILgwfoHlXrBdbxTcy1HAsrji7kdBUym0CG624Na3CssDvSlkmczPmva UoSLERgbLYCZInBDXJQbpKmWqiuHhNcOhUsCu0vCPRRsU7iivllueI3ql5VhJrFPK6SddbyoT5JhG 3P6JEFjO5wxFlNBhIJtBUtxosm2Zj/G6QJ58K++A8cGnG+LvXNaFD5s4tfiM0KpCvZKI8rh8tawBy 3fpXodq4idI+dHKVLbbF2i1nAenizXuZmGT6yyh+eG6FFj1jARFDqZ9YTFM/nlc9OGLUpTIAtpSUT vC/CkaVoOOxQJKQtzFtKvQ==; 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 1xTcxv-001uKo-1n; Wed, 18 Nov 2026 11:37:01 +0100 From: Mirian Shilakadze To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com Date: Wed, 18 Nov 2026 14:36:37 +0400 Message-ID: <20261118103656.363171-6-mirian.shilakadze@virtuozzo.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118103656.363171-1-mirian.shilakadze@virtuozzo.com> References: <20261118103656.363171-1-mirian.shilakadze@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v3 5/6] fs: keep the mount relaxations of a pseudosuper VE from container binaries 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 While a VE is pseudosuper, any task in it skips the device mount option filter and the VE mount limit, including the container's own binaries that vzctl and CRIU run. Give the option filter relaxation only to setup tasks. The mount limit also lets through a host task that joined the VE after it started, such as the CRIU helper that mounts proc for a nested pid namespace during restore. Without that, restoring such a container near its mount limit fails. Add ve_current_is_host_task() for the two kinds of host task. Feature: ve: CRIU support https://virtuozzo.atlassian.net/browse/VSTOR-151265 Signed-off-by: Mirian Shilakadze --- fs/namespace.c | 18 ++++++++++-------- include/linux/ve.h | 2 ++ kernel/ve/ve.c | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index d622d9b72d32..0eae165b1299 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3226,11 +3226,11 @@ int ve_devmnt_process(struct ve_struct *ve, dev_t dev, void **data_pp, int remou if (devmnt->dev == dev) { err = ve_devmnt_check(data, devmnt->allowed_options); /* - * In case of @is_pseudosuper set, ie restore procedure, - * we don't check for allowed options filtering, since + * Setup tasks of a pseudosuper VE, ie the restore + * procedure, skip the allowed options filtering, since * restore mode is special. */ - if (ve->is_pseudosuper) + if (ve_current_is_pseudosuper(ve)) err = 0; if (!err && !remount) @@ -3255,7 +3255,7 @@ int ve_devmnt_process(struct ve_struct *ve, dev_t dev, void **data_pp, int remou * the way userspace tool restore container * it might be nonempty as well. */ - if (ve->is_pseudosuper) { + if (ve_current_is_pseudosuper(ve)) { err = 0; } else if (((char *)*data_pp)[0] == '\0') { err = 0; @@ -3330,7 +3330,7 @@ int ve_devmnt_verify(struct ve_struct *ve, dev_t dev, char *opts, bool new_mount bool found = false; int err = 0; - if (ve->is_pseudosuper) + if (ve_current_is_pseudosuper(ve)) return 0; mutex_lock(&ve->devmnt_mutex); @@ -3367,9 +3367,11 @@ int ve_devmnt_verify(struct ve_struct *ve, dev_t dev, char *opts, bool new_mount static inline int ve_try_reserve_mount(struct ve_struct *ve) { - int ret = ve_is_super(ve) || ve->is_pseudosuper || - ve_is_super(get_exec_env()); - /* Ignore limits in ve0 and pseudosuper cases, but still count. */ + int ret = ve_current_is_host_task(ve) || ve_is_super(get_exec_env()); + /* + * Ignore limits in ve0 and for the host's tasks of a pseudosuper VE, + * but still count. + */ if (ret) atomic_dec(&ve->mnt_avail_nr); else diff --git a/include/linux/ve.h b/include/linux/ve.h index 56c310205394..5859550eb07c 100644 --- a/include/linux/ve.h +++ b/include/linux/ve.h @@ -285,6 +285,7 @@ extern bool is_ve_init_net(const struct net *net); void ve_setup_task(struct task_struct *p, struct ve_struct *old_ve, struct ve_struct *ve); bool ve_current_is_pseudosuper(struct ve_struct *ve); +bool ve_current_is_host_task(struct ve_struct *ve); int ve_vps_dumpable(struct mm_struct *mm, struct ve_struct *ve); void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool)); @@ -396,6 +397,7 @@ static inline int vz_security_protocol_check(struct net *net, int protocol) { re static inline void ve_setup_task(struct task_struct *p, struct ve_struct *old_ve, struct ve_struct *ve) { } static inline bool ve_current_is_pseudosuper(struct ve_struct *ve) { return true; } +static inline bool ve_current_is_host_task(struct ve_struct *ve) { return true; } #define ve_vps_dumpable(mm, ve) ((mm)->vps_dumpable) static inline void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool)) { } diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index 5dde3bde2c53..e5b152a83225 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -1804,6 +1804,20 @@ bool ve_current_is_pseudosuper(struct ve_struct *ve) return ve_is_super(ve) || ve_current_has_mark(ve, VD_VE_SETUP_TASK); } +/** + * ve_current_is_host_task - is current a host task of pseudosuper @ve + * @ve: the VE + * + * Always true for ve0. Otherwise true for a setup task of @ve and for a host + * task that joined @ve after it started, such as the CRIU helper that mounts + * proc for a nested pid namespace, until pseudosuper is cleared. + */ +bool ve_current_is_host_task(struct ve_struct *ve) +{ + return ve_current_is_pseudosuper(ve) || + ve_current_has_mark(ve, VD_VE_ENTER_TASK); +} + /** * ve_vps_dumpable - vps_dumpable of a task as the access checks see it * @mm: the task's mm -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel