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 827FA803F6 for ; Tue, 17 Nov 2026 10:15:38 +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 6AHAELGq007949; Tue, 17 Nov 2026 13:14:23 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAELGq007949 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="U0+Vyp1q" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AHADbmn007896 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 17 Nov 2026 13:13:38 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHADbmn007896 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4923b9fdd43so3314669f8f.3 for ; Tue, 17 Nov 2026 02:13:38 -0800 (PST) X-Gm-Message-State: APuU4Z+CME2WlBdpctHKk3soNqcaTc4V1LagMe2eTiUWEL8zTZK4M0C0 bWHEfMfH6p6YJGN8wADp69uo8LfxDGNv/XB6SJJbfW9KsUr7VG5ET6nyFv9FqQaUhlLaOX9i3Aa 0rhETm22pFvXf1AHv3OHYXl4nnpPmfyhzePhG8jF4g+gX3lkcuW3wPg== X-Gm-Gg: AZFdTZctO29xHjh51E4P2/Cbq10h3nO+J5C/SRviqXi0/odM+DjdN5qy1sDSk2LOF7I 5VIy7QO4fLMxKr7uoZQrcIWf+IgLz6ek7di0cOm8najNf5zSQOlcdOpjWtTegwmjJ+XQe3XHAs0 ZM/U3vi7OiU1FpJKmUN5/fU6RLGyo2Bl1mefw8NeeyjG7xAz5+IPsmAe4X8/yuxEvK0fOoQZ72P p6jp/1y4EVfKQSB9IcRbLQ16L++t0mdJ5udksgxQvJrp2DYJ9tO/1QIxN5Q5rvEJnwe+yVdYWU1 N1VuG9mSGYcZM2amtJ46ZrK887SlTbZZgQ8QUp1FKpRdQlTRuiboR4oTSSmNSwuG3j4cWdi1jWh OUuc/Q468PRSX8gv/0CmcM/6IiFUE X-Received: by 2002:a05:6000:4201:b0:490:9fe2:6a37 with SMTP id ffacd0b85a97d-49c70ed8f15mr32389293f8f.17.1794910417142; Tue, 17 Nov 2026 02:13:37 -0800 (PST) X-Received: by 2002:a05:6000:4201:b0:490:9fe2:6a37 with SMTP id ffacd0b85a97d-49c70ed8f15mr32389232f8f.17.1794910416573; Tue, 17 Nov 2026 02:13:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794910416; cv=none; d=google.com; s=arc-20260327; b=UrW5QFU9A1AbCU2dE9k71TJNUfzSCe34o1+l/HFObuULWwNe+dyyUQgO6LBOGP1CLg mBYPl2XxaE9/1QgwziVWuw3OT7EsSTmpdGBin+XSVgvHFnnxLIWQT4hx/QxsNT7bSh0u dzeVF1Hql4dulLkOYVXGlGCvZoNKymdAxqkeXmcrn34Ymu9tCerLVXksf4AAPBlTDi41 NLvXUR/Ug5DM2PbtHS3uMTIS0RziX3U9JRlVkfCOk0itKhlWfA5nMAmlTLZi9fT3xE9x dkLRYXsQj1s9ycbsGv5pSrqNAIL3qq7jrRPIe+AJK8EH6YsmmiLchm0E1XncXieZ05ni pNDA== 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=moYLnd6swtcOSqG6Y/XpE8CKTR2zo+MwRrSmLpixsw0=; fh=wpoNUURlquLpJK/14Kny0oMIYkY7mYwjJ/Ils9UT2kk=; b=XEwCmufwtMLVZhwsuDb8J3ZcSw9XqFPmferchiA+goUN4UNmxT9Xm1vY6JCca64/7j IVykapgDCPsVq2n0a5Y77VbtZT3/ClucvXrT6GzuWAYpWZFnjYUpyoaw4555xNJlx+Z3 N60SUg6dNQZLPKfQ6RQTno1Th/xTL/L3jgnm6t9uLXkEdTasJST70cCdGkAxYucU1vxy GKMaiu8a1oArzwPbVV952hWgIUL2HSh/+wfarEx4k/Oh6AHFqvhWcwonmGufCVQRAfMI JWKfvyjNhuNHrfy8xQmMzv2th8fRA/m+vr40jU7RqjprU5qeCDnDrdISyqsc1RHE3Vm1 OkrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=U0+Vyp1q; 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-49c6492071dsi26548763f8f.355.2026.11.17.02.13.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 02:13:36 -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=U0+Vyp1q; 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=moYLnd6swtcOSqG6Y/XpE8CKTR2zo+MwRrSmLpixsw0=; b=U0+Vyp1qfyDZ USXma4TAC97G6JocuTunxrlzfOl45af9YfIb/DH5JmkRdt09HB92PtRviDrrDa/3LVOfn2NQJgLT0 JVibJCQYDg8SH92JTGzGLE3ROBPlHv0L06yHSDnP2H9guxn3snwjmWgVDOHXK5deBS9C7LrXbITkZ Ilq3MpqEsbzwN+YujiTSf8gHQL9/y1aNjo9EWhzrFQquOAqxQmZFFlGnmXIRc98+PjICyiMZ5W6aj nufrshnIfsemdeUjLOeyXYoftDzDV4kCUISg389CQ5CnyezjNMvBD9S9zOpJ3RPIx1aRF5/qwGxAM D3nkDjLnvocZAkELhUiWsA==; 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 1xTG7j-009MQ7-2k; Tue, 17 Nov 2026 11:13:26 +0100 From: Mirian Shilakadze To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com Date: Tue, 17 Nov 2026 14:13:25 +0400 Message-ID: <20261117101329.225854-6-mirian.shilakadze@virtuozzo.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261117101329.225854-1-mirian.shilakadze@virtuozzo.com> References: <20261117101329.225854-1-mirian.shilakadze@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 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 | 12 ++++++------ include/linux/ve.h | 2 ++ kernel/ve/ve.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index d622d9b72d32..fd6ef93ed403 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,7 +3367,7 @@ 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 || + int ret = ve_is_super(ve) || ve_current_is_host_task(ve) || ve_is_super(get_exec_env()); /* Ignore limits in ve0 and pseudosuper cases, but still count. */ if (ret) 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 785d0ed4a05e..afa846593a11 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