[Devel] [PATCH hci-8.2 v2 6/6] ve: give the remaining pseudosuper relaxations only to setup tasks
Mirian Shilakadze
mirian.shilakadze at virtuozzo.com
Tue Nov 17 13:13:26 MSK 2026
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 at virtuozzo.com>
---
kernel/sys.c | 2 +-
kernel/ve/ve.c | 8 ++++----
net/netlink/af_netlink.c | 2 +-
security/device_cgroup.c | 8 ++++----
4 files changed, 10 insertions(+), 10 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 afa846593a11..bad7690ce32e 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1066,7 +1066,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);
@@ -1119,7 +1119,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++) {
@@ -1219,7 +1219,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();
@@ -1437,7 +1437,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..b0ef5f9380d1 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -923,15 +923,15 @@ static int devcgroup_legacy_check_permission(short type, u32 major, u32 minor,
#ifdef CONFIG_VE
/*
- * When restoring container allow everything in
- * pseudosuper state. We need this for early
- * mounting of second ploop device. Still, don't
+ * When restoring container allow everything to its
+ * setup tasks in pseudosuper state. We need this for
+ * early mounting of second ploop device. Still, don't
* change behaviour on the ve0.
*/
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
More information about the Devel
mailing list