From: no-reply@sashiko.virtuozzo.com
To: Konstantin Khorenko <khorenko@virtuozzo.com>,
Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH RFC hci-8.2 2/2] selftests/ve: check a host task entering a pseudosuper VE reaches its init
Date: Thu, 19 Nov 2026 21:54:37 +0000 [thread overview]
Message-ID: <010701a1f5cdf34a-ba5ccd5b-1965-4d46-96f1-11bb065285c4-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v1-2-06fa0b8994a8@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/ve: setup failure leaves cgv2_fd and pipe fds open
- [Low] selftests/ve: start_ve() leaks pipe fds on failure returns
--
commit e8d0bb859d8ed5e2c6bc741aea13996d73568ff
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
selftests/ve: check a host task entering a pseudosuper VE reaches its init
This adds ve_setup_task_test. It starts a VE the way vzctl does, with ve.pseudosuper set and an init cloned from the host that writes START to ve.state. It then checks that a host task entering the VE through the ve namespace can open the init's mnt namespace, and that a binary exec'd inside the VE still cannot.
> diff --git a/tools/testing/selftests/ve/ve_setup_task_test.c b/tools/testing/selftests/ve/ve_setup_task_test.c
> new file mode 100644
> index 0000000000000..e9f8851e91724
> --- /dev/null
> +++ b/tools/testing/selftests/ve/ve_setup_task_test.c
[ ... ]
> + /* The init: a host task cloned into the VE while it starts */
> + *what = "clone3";
> + if (enter_cgroup(self->cgv2_fd, self->ctid) < 0)
> + return -1;
> + self->init_pid = syscall(__NR_clone3, &cargs, sizeof(cargs));
> + if (self->init_pid == 0)
> + run_init(self, status, release);
> + close(status[1]);
> + close(release[0]);
> + self->init_release = release[1];
> + if (enter_cgroup(self->cgv2_fd, 0) < 0 || self->init_pid < 0)
> + return -1;
> +
> + *what = "ve.state START";
> + if (read(status[0], &c, 1) != 1)
> + return -1;
> + close(status[0]);
> + if (c) {
> + errno = c;
> + return -1;
> + }
[Severity: Low]
Do these early returns leak the pipe descriptors? If clone3() fails,
init_pid is -1 and start_ve() returns with release[1] stored in
init_release. stop_ve() closes init_release only when init_pid > 0, so
release[1] is never closed. If the read of status[0] fails, status[0]
is not closed either. The process is short-lived, so the effect is
small, but closing both descriptors on the failure paths would keep
the error handling tidy.
[ ... ]
> + /* The harness skips the teardown when the setup fails */
> + ret = start_ve(self, &what);
> + err = errno;
> + if (ret)
> + stop_ve(self);
> + ASSERT_EQ(ret, 0) TH_LOG("%s: %s", what, strerror(err));
[Severity: Low]
Does this failure path leak self->cgv2_fd? As the comment says, the
harness skips FIXTURE_TEARDOWN when setup fails. Only stop_ve() runs
here, and it never closes cgv2_fd. The close(self->cgv2_fd) sits only
in FIXTURE_TEARDOWN. Closing cgv2_fd in this error branch after
stop_ve() would fix it.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119-b4-prep-khorenko-vstor-156164-ve-setup-task-pseudosuper-v1-0-06fa0b8994a8@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-11-19 21:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 21:49 [Devel] [PATCH RFC hci-8.2 0/2] ve: Container start on the 26.3 kernel with libvzctl before 10.0.144 Konstantin Khorenko
2026-11-19 21:49 ` [Devel] [PATCH RFC hci-8.2 1/2] ve: mark a host task entering a pseudosuper VE as a setup task Konstantin Khorenko
2026-11-19 21:56 ` no-reply
2026-11-19 21:49 ` [Devel] [PATCH RFC hci-8.2 2/2] selftests/ve: check a host task entering a pseudosuper VE reaches its init Konstantin Khorenko
2026-11-19 21:54 ` no-reply [this message]
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=010701a1f5cdf34a-ba5ccd5b-1965-4d46-96f1-11bb065285c4-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=mirian.shilakadze@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.