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 <[email protected]> --- 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 [email protected] https://lists.openvz.org/mailman/listinfo/devel
