From: no-reply@sashiko.virtuozzo.com
To: Konstantin Khorenko <khorenko@virtuozzo.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 2/2] selftests/ve: check that the NUMA API syscalls return ENOSYS in a VE
Date: Thu, 5 Nov 2026 18:54:04 +0000 [thread overview]
Message-ID: <010701a1ad0f9d4b-bebe6bb0-ff69-473a-af79-f0de8c17c629-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261105-b4-prep-khorenko-vstor-153679-mbind-ve-v1-2-b4fcd27c8001@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] selftests/ve: numa syscalls test fails instead of skipping on non-NUMA host
- [Low] selftests/ve: FIXTURE_SETUP does not initialise ctid before teardown uses it
--
commit 3833f07c24efbbde914f6df791979fabf50e44b6
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
selftests/ve: check that the NUMA API syscalls return ENOSYS in a VE
This adds a selftest that calls all six NUMA API syscalls on the host and
inside a VE. It expects 0 on the host and -ENOSYS in the VE.
Link: https://virtuozzo.atlassian.net/browse/VSTOR-153679
> diff --git a/tools/testing/selftests/ve/ve_numa_syscalls_prohibited_test.c b/tools/testing/selftests/ve/ve_numa_syscalls_prohibited_test.c
> new file mode 100644
> index 000000000000..4cae1c74b46b
> --- /dev/null
> +++ b/tools/testing/selftests/ve/ve_numa_syscalls_prohibited_test.c
[ ... ]
> +FIXTURE(numa_syscalls)
> +{
> + int cgv2_fd;
> + int ctid;
> +};
> +
> +FIXTURE_SETUP(numa_syscalls)
> +{
> + unsigned long allowed[NODE_BITS / LONG_BITS] = { 0 };
> + unsigned int i;
> +
> + self->cgv2_fd = -1;
> +
> + if (geteuid() != 0)
> + SKIP(return, "creating a ve cgroup needs root");
[ ... ]
> + ASSERT_EQ(syscall(__NR_get_mempolicy, NULL, allowed, NODE_BITS + 1UL,
> + 0UL, MPOL_F_MEMS_ALLOWED), 0);
[Severity: Medium]
Can this probe turn into a false failure on a host without NUMA support?
If the host kernel lacks CONFIG_NUMA or CONFIG_MIGRATION, or seccomp blocks
these syscalls, get_mempolicy() returns -ENOSYS on the host. The
ASSERT_EQ(..., 0) in FIXTURE_SETUP(numa_syscalls) then aborts setup with a
failure, and ve_calls_return_enosys never runs.
The sibling ve_numa_migrate_test uses SKIP for missing NUMA preconditions.
Would a SKIP be more appropriate here when the probe returns -1 with
errno == ENOSYS?
[ ... ]
> +FIXTURE_TEARDOWN(numa_syscalls)
> +{
> + if (self->cgv2_fd >= 0) {
> + destroy_ve(self->cgv2_fd, self->ctid);
> + close(self->cgv2_fd);
> + }
> +}
[Severity: Low]
Is self->ctid initialized before FIXTURE_TEARDOWN(numa_syscalls) uses it?
FIXTURE_SETUP(numa_syscalls) sets self->cgv2_fd = -1 but never sets
self->ctid. If an ASSERT fails after mount_cg2_fd() succeeds and before
make_ve() assigns ctid, for example the write_file_at() of
cgroup.subtree_control, the teardown sees cgv2_fd >= 0 and calls
destroy_ve(self->cgv2_fd, self->ctid) with ctid unset.
destroy_ve() only returns early for id < 0, so it would try to remove
cgroup "0" with its retry loop. Would setting self->ctid = -1 next to
self->cgv2_fd = -1 avoid this?
> +TEST_F(numa_syscalls, host_calls_succeed)
> +{
> + struct call_result res[NR_CALLS];
> + unsigned int i;
> +
> + run_calls(res);
> + for (i = 0; i < NR_CALLS; i++) {
> + EXPECT_EQ(res[i].ret, 0)
> + TH_LOG("%s on the host: %s", numa_calls[i].name,
> + strerror(res[i].err));
> + }
> +}
[Severity: Medium]
Does host_calls_succeed report a failure when a call returns -ENOSYS on the
host?
On a host where the NUMA syscalls are unavailable, the EXPECT_EQ(res[i].ret,
0) check fails the test instead of skipping it. The commit message says the
host result is what shows the ENOSYS in the VE comes from the VE check, so
an environment that cannot provide that baseline might be better reported
as a skip.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261105-b4-prep-khorenko-vstor-153679-mbind-ve-v1-0-b4fcd27c8001@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-11-05 18:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 18:48 [Devel] [PATCH hci-8.1 0/2] mempolicy: prohibit mbind and set_mempolicy_home_node in VE Konstantin Khorenko
2026-11-05 18:48 ` [Devel] [PATCH hci-8.1 1/2] " Konstantin Khorenko
2026-11-05 18:52 ` no-reply
2026-11-05 18:48 ` [Devel] [PATCH hci-8.1 2/2] selftests/ve: check that the NUMA API syscalls return ENOSYS in a VE Konstantin Khorenko
2026-11-05 18: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=010701a1ad0f9d4b-bebe6bb0-ff69-473a-af79-f0de8c17c629-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=vasileios.almpanis@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.