From: "Mickaël Salaün" <mic@digikod.net>
To: Sean Christopherson <seanjc@google.com>
Cc: Kees Cook <keescook@chromium.org>,
Jakub Kicinski <kuba@kernel.org>,
Mark Brown <broonie@kernel.org>,
davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, shuah@kernel.org,
linux-kselftest@vger.kernel.org,
linux-security-module@vger.kernel.org, jakub@cloudflare.com,
kvm@vger.kernel.org
Subject: Re: [PATCH v4 00/12] selftests: kselftest_harness: support using xfail
Date: Thu, 2 May 2024 23:07:10 +0200 [thread overview]
Message-ID: <20240502.iwu8buoQuah1@digikod.net> (raw)
In-Reply-To: <ZjPelW6-AbtYvslu@google.com>
On Thu, May 02, 2024 at 11:42:29AM GMT, Sean Christopherson wrote:
> +kvm
>
> On Tue, Mar 05, 2024, Mickaël Salaün wrote:
> > On Tue, Mar 05, 2024 at 01:43:14AM -0800, Kees Cook wrote:
> > > On Mon, Mar 04, 2024 at 03:39:02PM -0800, Jakub Kicinski wrote:
> > > > On Mon, 4 Mar 2024 15:14:04 -0800 Kees Cook wrote:
> > > > > > Ugh, I'm guessing vfork() "eats" the signal, IOW grandchild signals,
> > > > > > child exits? vfork() and signals.. I'd rather leave to Kees || Mickael.
> > > > >
> > > > > Oh no, that does seem bad. Since Mickaël is also seeing weird issues,
> > > > > can we drop the vfork changes for now?
> > > >
> > > > Seems doable, but won't be a simple revert. "drop" means we'd need
> > > > to bring ->step back. More or less go back to v3.
> > >
> > > I think we have to -- other CIs are now showing the most of seccomp
> > > failing now. (And I can confirm this now -- I had only tested seccomp
> > > on earlier versions of the series.)
> >
> > Sorry for the trouble, I found and fixed the vfork issues.
>
> Heh, you found and fixed _some of_ the vfork issues. This whole mess completely
> breaks existing tests that use TEST_F() and exit() with non-zero values to
> indicate failure, including failures that occur during FIXTURE_SETUP().
>
> E.g. all of the KVM selftests that use KVM_ONE_VCPU_TEST() are broken and will
> always show all tests as passing.
>
> The below gets things working for KVM selftests again, but (a) I have no idea if
> it's a complete fix, (b) I don't know if it will break other users of the harness,
> and (c) I don't understand why spawning a grandchild is the default behavior, i.e.
> why usage that has zero need of separating teardown from setup+run is subjected to
> the complexity of the handful of tests that do.
Thanks for the fix. I think it covers almost all cases. I'd handle the
same way the remaining _exit() though. The grandchild changes was a
long due patch from the time I added kselftest_harness.h and forked the
TEST_F() macro. I'll send a new patch series with this fix.
>
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index 4fd735e48ee7..24e95828976f 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -391,7 +391,7 @@
> fixture_name##_setup(_metadata, &self, variant->data); \
> /* Let setup failure terminate early. */ \
> if (_metadata->exit_code) \
> - _exit(0); \
> + _exit(_metadata->exit_code); \
> _metadata->setup_completed = true; \
> fixture_name##_##test_name(_metadata, &self, variant->data); \
> } else if (child < 0 || child != waitpid(child, &status, 0)) { \
> @@ -406,8 +406,10 @@
> } \
> if (_metadata->setup_completed && _metadata->teardown_parent) \
> fixture_name##_teardown(_metadata, &self, variant->data); \
> - if (!WIFEXITED(status) && WIFSIGNALED(status)) \
> - /* Forward signal to __wait_for_test(). */ \
> + /* Forward exit codes and signals to __wait_for_test(). */ \
> + if (WIFEXITED(status)) \
> + _exit(WEXITSTATUS(status)); \
> + else if (WIFSIGNALED(status)) \
> kill(getpid(), WTERMSIG(status)); \
> __test_check_assert(_metadata); \
> } \
>
next prev parent reply other threads:[~2024-05-02 21:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 0:59 [PATCH v4 00/12] selftests: kselftest_harness: support using xfail Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 01/12] selftests/landlock: Redefine TEST_F() as TEST_F_FORK() Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 02/12] selftests/harness: Merge TEST_F_FORK() into TEST_F() Jakub Kicinski
2024-03-04 19:27 ` Mickaël Salaün
2024-03-04 19:31 ` Mickaël Salaün
2024-03-05 15:47 ` Mickaël Salaün
2024-03-05 15:56 ` [PATCH v1 0/2] " Mickaël Salaün
2024-03-05 15:56 ` [PATCH v1 1/2] selftests/landlock: Redefine TEST_F() as TEST_F_FORK() Mickaël Salaün
2024-03-05 15:56 ` [PATCH v1 2/2] selftests/harness: Merge TEST_F_FORK() into TEST_F() Mickaël Salaün
2024-02-29 0:59 ` [PATCH v4 03/12] selftests: kselftest_harness: use KSFT_* exit codes Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 04/12] selftests: kselftest_harness: generate test name once Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 05/12] selftests: kselftest_harness: save full exit code in metadata Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 06/12] selftests: kselftest_harness: use exit code to store skip Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 07/12] selftests: kselftest: add ksft_test_result_code(), handling all exit codes Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 08/12] selftests: kselftest_harness: print test name for SKIP Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 09/12] selftests: kselftest_harness: separate diagnostic message with # in ksft_test_result_code() Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 10/12] selftests: kselftest_harness: let PASS / FAIL provide diagnostic Jakub Kicinski
2024-04-16 14:11 ` Muhammad Usama Anjum
2024-02-29 0:59 ` [PATCH v4 11/12] selftests: kselftest_harness: support using xfail Jakub Kicinski
2024-02-29 0:59 ` [PATCH v4 12/12] selftests: ip_local_port_range: use XFAIL instead of SKIP Jakub Kicinski
2024-02-29 20:19 ` Jakub Sitnicki
2024-02-29 23:25 ` Xin Long
2024-03-01 10:40 ` Jakub Sitnicki
2024-03-01 10:40 ` [PATCH v4 00/12] selftests: kselftest_harness: support using xfail patchwork-bot+netdevbpf
2024-03-04 22:20 ` Mark Brown
2024-03-04 23:04 ` Jakub Kicinski
2024-03-04 23:14 ` Kees Cook
2024-03-04 23:39 ` Jakub Kicinski
2024-03-05 9:43 ` Kees Cook
2024-03-05 16:05 ` Mickaël Salaün
2024-03-05 18:06 ` Jakub Kicinski
2024-03-05 19:14 ` Mickaël Salaün
2024-03-05 20:10 ` [PATCH] selftests/harness: Fix TEST_F()'s vfork handling Mickaël Salaün
2024-03-05 20:25 ` Jakub Kicinski
2024-03-06 7:25 ` Mickaël Salaün
2024-03-06 7:32 ` Mickaël Salaün
2024-03-05 20:31 ` Kees Cook
2024-03-06 13:25 ` Mark Brown
2024-03-07 4:40 ` patchwork-bot+netdevbpf
2024-05-02 18:42 ` [PATCH v4 00/12] selftests: kselftest_harness: support using xfail Sean Christopherson
2024-05-02 21:07 ` Mickaël Salaün [this message]
2024-03-05 15:48 ` Przemek Kitszel
2024-03-05 16:00 ` Mickaël Salaün
2024-03-05 16:39 ` Mickaël Salaün
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=20240502.iwu8buoQuah1@digikod.net \
--to=mic@digikod.net \
--cc=broonie@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jakub@cloudflare.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).