From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com, ptikhomirov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks
Date: Mon, 16 Nov 2026 14:45:49 +0400 [thread overview]
Message-ID: <20261116104552.102938-7-mirian.shilakadze@virtuozzo.com> (raw)
In-Reply-To: <20261116104552.102938-1-mirian.shilakadze@virtuozzo.com>
While a VE is pseudosuper, any task in it may set NETLINK_REPAIR, set
its CT fields with prctl, write ve.features, ve.failcount, ve.pid_max
and ve.aio_max_nr, and pass the legacy device cgroup check. That
includes the container's own binaries that vzctl and CRIU run.
Use ve_current_is_pseudosuper() for these as well.
Feature: ve: CRIU support
https://virtuozzo.atlassian.net/browse/VSTOR-151265
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
kernel/sys.c | 2 +-
kernel/ve/ve.c | 8 ++++----
net/netlink/af_netlink.c | 2 +-
security/device_cgroup.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 80f8b9eb17c3..21650d331a42 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2324,7 +2324,7 @@ static int prctl_set_task_ct_fields(struct task_struct *t, unsigned long arg,
#ifdef CONFIG_VE
struct ve_struct *ve __free(put_ve) = get_task_ve(t);
- if (!ve_is_super(ve) && !ve->is_pseudosuper)
+ if (!ve_is_super(ve) && !ve_current_is_pseudosuper(ve))
return -EPERM;
#endif
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index f7f802dc7ffb..ebb52a1b678d 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1075,7 +1075,7 @@ static int ve_features_write(struct cgroup_subsys_state *css, struct cftype *cft
struct ve_struct *ve = css_to_ve(css);
if (!ve_is_super(get_exec_env()) &&
- !ve->is_pseudosuper)
+ !ve_current_is_pseudosuper(ve))
return -EPERM;
down_write(&ve->op_sem);
@@ -1128,7 +1128,7 @@ static ssize_t ve_failcount_write(struct kernfs_open_file *of, char *buf,
const struct ve_failcount_entry *entry;
atomic_t *fc;
- if (!ve_is_super(get_exec_env()) && !ve->is_pseudosuper)
+ if (!ve_is_super(get_exec_env()) && !ve_current_is_pseudosuper(ve))
return -EPERM;
for (entry = ve_failcounts; entry->name; entry++) {
@@ -1228,7 +1228,7 @@ static int ve_pid_max_write_running_u64(struct cgroup_subsys_state *css,
struct nsproxy *ve_nsproxy;
if (!ve_is_super(get_exec_env()) &&
- !ve->is_pseudosuper)
+ !ve_current_is_pseudosuper(ve))
return -EPERM;
rcu_read_lock();
@@ -1446,7 +1446,7 @@ static int ve_aio_max_nr_write(struct cgroup_subsys_state *css,
{
struct ve_struct *ve = css_to_ve(css);
- if (!ve_is_super(get_exec_env()) && !ve->is_pseudosuper)
+ if (!ve_is_super(get_exec_env()) && !ve_current_is_pseudosuper(ve))
return -EPERM;
down_write(&ve->op_sem);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index f686e6ea30ce..e808d8ae3e1e 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1695,7 +1695,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
#ifdef CONFIG_VE
{
struct ve_struct *ve = get_exec_env();
- if (!ve_is_super(ve) && !ve->is_pseudosuper)
+ if (!ve_is_super(ve) && !ve_current_is_pseudosuper(ve))
return -ENOPROTOOPT;
}
#endif
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 1629896b2ea1..fdeb136a3bec 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -931,7 +931,7 @@ static int devcgroup_legacy_check_permission(short type, u32 major, u32 minor,
if (!rc) {
struct ve_struct *ve = get_exec_env();
- if (!ve_is_super(ve) && ve->is_pseudosuper)
+ if (!ve_is_super(ve) && ve_current_is_pseudosuper(ve))
return 0;
return -EPERM;
}
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-16 10:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 10:45 [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Mirian Shilakadze
2026-11-16 10:45 ` [Devel] [PATCH vz10 1/6] ve: tell ve_setup_task() which VE the task comes from Mirian Shilakadze
2026-11-16 10:50 ` no-reply
2026-11-16 10:45 ` [Devel] [PATCH vz10 2/6] ve: hide only the tasks the host sends into a VE Mirian Shilakadze
2026-11-16 10:50 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 3/6] ve: hide the tasks that set up a starting VE from the rest of it Mirian Shilakadze
2026-11-16 10:55 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 4/6] cgroup: give the CT root file writes and hidden roots only to setup tasks Mirian Shilakadze
2026-11-16 10:53 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` [Devel] [PATCH vz10 5/6] fs: give the mount relaxations of a pseudosuper VE " Mirian Shilakadze
2026-11-16 10:56 ` no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 10:45 ` Mirian Shilakadze [this message]
2026-11-16 10:56 ` [Devel] [PATCH vz10 6/6] ve: give the remaining pseudosuper relaxations " no-reply
2026-11-16 17:17 ` Konstantin Khorenko
2026-11-16 17:17 ` [Devel] [PATCH vz10 0/6] ve: give the pseudosuper privileges only to the tasks setting up a VE Konstantin Khorenko
2026-11-17 10:21 ` Mirian Shilakadze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116104552.102938-7-mirian.shilakadze@virtuozzo.com \
--to=mirian.shilakadze@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox