From: no-reply@sashiko.virtuozzo.com
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>, khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 6/6] selftests/futex: fail futex_waitv when the waiter failed
Date: Mon, 26 Oct 2026 12:47:06 +0000 [thread overview]
Message-ID: <010701a178401050-e15c240c-2704-47df-8b7f-0ceb76183fa3-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261026124139.606106-7-eva.kurchatova@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/futex: futex_waitv double-reports subtest when waiterfn() fails
--
commit d7a86a7b77fbc111f003b6a1f5173be520b5ac79
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
selftests/futex: fail futex_waitv when the waiter failed
This patch joins the waiter thread after each futex_wake() in the private
and shared subtests of futex_waitv. It also sets the exit status to
RET_FAIL if ksft_get_fail_cnt() is non-zero at the end of main().
Link: https://virtuozzo.atlassian.net/browse/VSTOR-134205
> diff --git a/tools/testing/selftests/futex/functional/futex_waitv.c b/tools/testing/selftests/futex/functional/futex_waitv.c
> --- a/tools/testing/selftests/futex/functional/futex_waitv.c
> +++ b/tools/testing/selftests/futex/functional/futex_waitv.c
[ ... ]
> @@ -100,6 +100,7 @@ int main(int argc, char *argv[])
> usleep(WAKE_WAIT_US);
>
> res = futex_wake(u64_to_ptr(waitv[NR_FUTEXES - 1].uaddr), 1, FUTEX_PRIVATE_FLAG);
> + pthread_join(waiter, NULL);
> if (res != 1) {
> ksft_test_result_fail("futex_wake private returned: %d %s\n",
> res ? errno : res,
> res ? strerror(errno) : "");
> ret = RET_FAIL;
> } else {
> ksft_test_result_pass("futex_waitv private\n");
> }
[Severity: Medium]
Can this report the same subtest twice?
If waiterfn() fails, it calls ksft_test_result_fail() itself:
waiterfn()
res = futex_waitv(waitv, NR_FUTEXES, 0, &to, CLOCK_MONOTONIC);
if (res < 0) {
ksft_test_result_fail("futex_waitv returned: %d %s\n", ...);
The pthread_join() here discards the waiter's return value. If
futex_wake() then returns 1, main() still reaches
ksft_test_result_pass("futex_waitv private\n").
That would print both a "not ok" and an "ok" line for the same subtest.
The total number of results would then exceed ksft_set_plan(7).
The same applies to the shared case, which ends in
ksft_test_result_pass("futex_waitv shared\n").
Would it be cleaner for waiterfn() to return its status, so that main()
collects it through pthread_join() and reports a single result per subtest?
[ ... ]
> @@ -232,6 +234,10 @@ int main(int argc, char *argv[])
> ksft_test_result_pass("futex_waitv invalid clockid\n");
> }
>
> + /* The waiter records its own failures */
> + if (ksft_get_fail_cnt())
> + ret = RET_FAIL;
> +
[Severity: Medium]
Does this check only fix the exit code?
ksft_get_fail_cnt() is a global counter. It cannot tell a waiter failure
from a failure in main(). It also cannot attribute the failure to a
particular subtest.
Returning the waiter's status through pthread_join() would make this check
unnecessary.
> ksft_print_cnts();
> return ret;
> }
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261026124139.606106-1-eva.kurchatova@virtuozzo.com?part=6
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-10-26 12:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 12:40 [Devel] [PATCH hci-8.1 0/6] selftests: fix sticky failure in runners Eva Kurchatova
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 1/6] ms/selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh Eva Kurchatova
2026-10-26 12:44 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 2/6] selftests/memfd: fail run_hugetlbfs_test.sh when a test fails Eva Kurchatova
2026-10-26 12:44 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 3/6] selftests: sigaltstack: report the failures the signal handler records Eva Kurchatova
2026-10-26 12:45 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 4/6] selftests/zram: fail when a step fails Eva Kurchatova
2026-10-26 12:46 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 5/6] selftests/futex: fail run.sh when a test fails Eva Kurchatova
2026-10-26 12:47 ` no-reply
2026-10-26 12:40 ` [Devel] [PATCH hci-8.1 6/6] selftests/futex: fail futex_waitv when the waiter failed Eva Kurchatova
2026-10-26 12:47 ` 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=010701a178401050-e15c240c-2704-47df-8b7f-0ceb76183fa3-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=devel@openvz.org \
--cc=eva.kurchatova@virtuozzo.com \
--cc=khorenko@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