From: Cyril Hrubis <chrubis@suse.cz>
To: Jan Stancek <jstancek@redhat.com>
Cc: liwan@redhat.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/getrandom05: use tst_syscall
Date: Fri, 6 Dec 2024 11:36:45 +0100 [thread overview]
Message-ID: <Z1LTvZEBUvK744Ye@yuki.lan> (raw)
In-Reply-To: <e1dc1e7f686bfed84f048294b3f3608e2f3e9491.1733321853.git.jstancek@redhat.com>
Hi!
> With glibc-2.40 and recent kernel (6.12) the test uses
> vdso implementation which runs into SIGSEGV for EFAULT test:
>
> #0 __arch_chacha20_blocks_nostack () at arch/x86/entry/vdso/vgetrandom-chacha.S:146
> 146 movups state0,0x00(output)
>
> (gdb) bt
> #0 __arch_chacha20_blocks_nostack () at arch/x86/entry/vdso/vgetrandom-chacha.S:146
> #1 0x00007fcd3ce6417a in __cvdso_getrandom_data (rng_info=0x7fcd3ce5f280, buffer=0xffffffffffffffff, len=64, flags=1, opaque_state=0x7fcd3ce5df00,
> opaque_len=<optimized out>) at arch/x86/entry/vdso/../../../../lib/vdso/getrandom.c:237
> #2 __cvdso_getrandom (buffer=<optimized out>, len=64, flags=1, opaque_state=0x7fcd3ce5df00, opaque_len=<optimized out>)
> at arch/x86/entry/vdso/../../../../lib/vdso/getrandom.c:259
> #3 __vdso_getrandom (buffer=0xffffffffffffffff, len=64, flags=1, opaque_state=0x7fcd3ce5df00, opaque_len=<optimized out>)
> at arch/x86/entry/vdso/vgetrandom.c:11
> #4 0x00007fcd3cc7faf3 in getrandom_vdso (buffer=0xffffffffffffffff, length=64, flags=0, cancel=<optimized out>)
> at ../sysdeps/unix/sysv/linux/getrandom.c:204
> #5 0x0000000000401ff7 in verify_getrandom (i=0) at getrandom05.c:40
>
> Change the test to use syscall implementation of getrandom().
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/kernel/syscalls/getrandom/getrandom05.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/getrandom/getrandom05.c b/testcases/kernel/syscalls/getrandom/getrandom05.c
> index 92098deb723d..8f7ce45785c5 100644
> --- a/testcases/kernel/syscalls/getrandom/getrandom05.c
> +++ b/testcases/kernel/syscalls/getrandom/getrandom05.c
> @@ -16,6 +16,7 @@
>
> #include "tst_test.h"
> #include "lapi/getrandom.h"
> +#include "lapi/syscalls.h"
>
> static char buff_efault[64];
> static char buff_einval[64];
> @@ -36,7 +37,7 @@ static void verify_getrandom(unsigned int i)
> {
> struct test_case_t *tc = &tcases[i];
>
> - TST_EXP_FAIL2(getrandom(tc->buff, tc->size, tc->flag),
> + TST_EXP_FAIL2(tst_syscall(__NR_getrandom, tc->buff, tc->size, tc->flag),
> tc->expected_errno, "%s", tc->desc);
This means that we will not cover the EINVAL error for VDSO anymore.
Also the rest of the tests seems to use syscall only, which means that
we will not test the VDSO that is going to be used by default. I suppose
that we should add test variants to these testcases and run them both
for libc getrandom() and the syscall and just skip the EFAULT here on
glibc.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-12-06 10:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 14:18 [LTP] [PATCH] syscalls/getrandom05: use tst_syscall Jan Stancek
2024-12-05 1:48 ` Li Wang
2024-12-06 10:36 ` Cyril Hrubis [this message]
2024-12-06 10:55 ` Jan Stancek
2024-12-06 13:36 ` [LTP] [PATCH v2] syscalls/getrandom05: add test variants Jan Stancek
2024-12-06 14:34 ` Cyril Hrubis
2024-12-09 7:09 ` Li Wang
2024-12-09 7:31 ` Jan Stancek
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=Z1LTvZEBUvK744Ye@yuki.lan \
--to=chrubis@suse.cz \
--cc=jstancek@redhat.com \
--cc=liwan@redhat.com \
--cc=ltp@lists.linux.it \
/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