From: Richard Palethorpe <rpalethorpe@suse.de>
To: Wei Gao <wegao@suse.com>
Cc: Martin Doucha <mdoucha@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] clone302: Fix short size test
Date: Mon, 04 Sep 2023 08:48:51 +0100 [thread overview]
Message-ID: <8734zugyo8.fsf@suse.de> (raw)
In-Reply-To: <20230902074726.9837-1-wegao@suse.com>
Hello,
Wei Gao via ltp <ltp@lists.linux.it> writes:
> Signed-off-by: Wei Gao <wegao@suse.com>
> ---
> include/lapi/sched.h | 4 ++++
> testcases/kernel/syscalls/clone3/clone302.c | 3 ++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/lapi/sched.h b/include/lapi/sched.h
> index ac766efc5..f1133ca12 100644
> --- a/include/lapi/sched.h
> +++ b/include/lapi/sched.h
> @@ -46,6 +46,10 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
> }
>
> #ifndef HAVE_CLONE3
> +
> +#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */
I think what Martin meant was to define a minimal struct, which I prefer
for a few reasons.
You can find the original def in commit:
7f192e3cd316ba58c88dfa26796cf77789dd9872
(I found that using Git blame on fork.c)
Then you can assert our struct is == 64 during the test. This is
paranoid, but it checks that the test is compiled correctly and we
defined the structure correctly.
> +#define CLONE_ARGS_SIZE_VER2 88 /* sizeof third published struct */
> +
> struct clone_args {
> uint64_t __attribute__((aligned(8))) flags;
> uint64_t __attribute__((aligned(8))) pidfd;
> diff --git a/testcases/kernel/syscalls/clone3/clone302.c b/testcases/kernel/syscalls/clone3/clone302.c
> index b1b4ccebb..02ccb3c29 100644
> --- a/testcases/kernel/syscalls/clone3/clone302.c
> +++ b/testcases/kernel/syscalls/clone3/clone302.c
> @@ -34,7 +34,8 @@ static struct tcase {
> } tcases[] = {
> {"invalid args", &invalid_args, sizeof(*valid_args), 0, NULL, SIGCHLD, 0, 0, 0, EFAULT},
> {"zero size", &valid_args, 0, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
> - {"short size", &valid_args, sizeof(*valid_args) - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
> + {"short size", &valid_args, CLONE_ARGS_SIZE_VER0 - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
> + {"short size for clone_into_group flag", &valid_args, CLONE_ARGS_SIZE_VER2 - 1, CLONE_INTO_CGROUP, NULL, SIGCHLD, 0, 0, 0, EINVAL},
> {"extra size", &valid_args, sizeof(*valid_args) + 1, 0, NULL, SIGCHLD, 0, 0, 0, EFAULT},
> {"sighand-no-VM", &valid_args, sizeof(*valid_args), CLONE_SIGHAND, NULL, SIGCHLD, 0, 0, 0, EINVAL},
> {"thread-no-sighand", &valid_args, sizeof(*valid_args), CLONE_THREAD, NULL, SIGCHLD, 0, 0, 0, EINVAL},
> --
> 2.35.3
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-09-04 7:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-02 5:56 [LTP] [PATCH v1] clone302: Fix short size test Wei Gao via ltp
2023-09-02 7:47 ` [LTP] [PATCH v2] " Wei Gao via ltp
2023-09-04 7:48 ` Richard Palethorpe [this message]
2023-09-04 8:52 ` [LTP] [PATCH v3] " Wei Gao via ltp
2023-09-05 8:40 ` Richard Palethorpe
2023-09-05 10:14 ` [LTP] [PATCH v4] " Wei Gao via ltp
2023-09-06 7:55 ` Richard Palethorpe
2023-09-07 10:01 ` [LTP] [PATCH v5] " Wei Gao via ltp
2023-09-07 11:11 ` Richard Palethorpe
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=8734zugyo8.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=mdoucha@suse.com \
--cc=wegao@suse.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