From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linux-kernel@vger.kernel.org, adhemerval.zanella@linaro.org,
xry111@xry111.site
Subject: Re: [PATCH] selftests: vDSO: ensure vgetrandom works in a time namespace
Date: Mon, 9 Sep 2024 14:57:01 +0200 [thread overview]
Message-ID: <Zt7wndSBTuqGlViB@zx2c4.com> (raw)
In-Reply-To: <6c84d516-a3fd-4b9f-a27d-8da8ff117c92@csgroup.eu>
On Mon, Sep 09, 2024 at 12:42:01PM +0200, Christophe Leroy wrote:
> > + assert(unshare(CLONE_NEWUSER) == 0 && unshare(CLONE_NEWTIME) == 0);
>
> ~# ./vdso_test_getrandom
> TAP version 13
> 1..2
> ok 1 getrandom: PASS
> vdso_test_getrandom: vdso_test_getrandom.c:276: kselftest: Assertion
> `ret == 0' failed.
> Aborted
>
> That's too strong. When unshare() returns EINVAL it means the kernel is
> not built with CONFIG_TIME_NS. In that case the test should be SKIPPED.
>
> And when unshare() returns EPERM, it means the user is not authorised to
> use unshare(), that's an expected error that shouldn't lead to an assert
> either, instead it should gracefully says FAILED I think.
Generally those assertions are for when the test itself or the test
environment is broken, rather than the thing the test is testing for.
The CLONE_NEWUSER can be split into a separate unshare statement,
though, and then the return value can be ignored. The only point of it
is to make it less likely that the CLONE_NEWTIME will fail. I'll fix
that up.
Jason
next prev parent reply other threads:[~2024-09-09 12:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 19:17 [PATCH v5 0/5] Wire up getrandom() vDSO implementation on powerpc Christophe Leroy
2024-09-02 19:17 ` [PATCH v5 1/5] mm: Define VM_DROPPABLE for powerpc/32 Christophe Leroy
2024-09-02 19:17 ` [PATCH v5 2/5] powerpc/vdso32: Add crtsavres Christophe Leroy
2024-09-02 19:17 ` [PATCH v5 3/5] powerpc/vdso: Refactor CFLAGS for CVDSO build Christophe Leroy
2024-09-02 19:17 ` [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32 Christophe Leroy
2024-09-05 16:13 ` Jason A. Donenfeld
2024-09-05 16:25 ` Jason A. Donenfeld
2024-09-05 16:55 ` Christophe Leroy
2024-09-05 17:01 ` Xi Ruoyao
2024-09-05 17:03 ` Jason A. Donenfeld
2024-09-05 17:16 ` Jason A. Donenfeld
2024-09-05 17:31 ` [PATCH] selftests: vDSO: ensure vgetrandom works in a time namespace Jason A. Donenfeld
2024-09-09 10:42 ` Christophe Leroy
2024-09-09 12:57 ` Jason A. Donenfeld [this message]
2024-09-05 20:41 ` [PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32 Jason A. Donenfeld
2024-09-06 2:48 ` Jason A. Donenfeld
2024-09-06 3:24 ` Jason A. Donenfeld
2024-09-06 4:53 ` Christophe Leroy
2024-09-02 19:17 ` [PATCH v5 5/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO64 Christophe Leroy
2024-09-04 11:46 ` Madhavan Srinivasan
2024-09-04 14:16 ` [PATCH v5 0/5] Wire up getrandom() vDSO implementation on powerpc Jason A. Donenfeld
2024-09-04 14:36 ` Christophe Leroy
2024-09-05 12:18 ` Michael Ellerman
2024-09-05 12:56 ` Jason A. Donenfeld
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=Zt7wndSBTuqGlViB@zx2c4.com \
--to=jason@zx2c4.com \
--cc=adhemerval.zanella@linaro.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=xry111@xry111.site \
/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