From: Richard Palethorpe <rpalethorpe@suse.de>
To: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] containers/utsname04: don't use TST_EXP_EQ_LI for tst_clone
Date: Mon, 06 Mar 2023 14:10:15 +0000 [thread overview]
Message-ID: <87bkl67xxa.fsf@suse.de> (raw)
In-Reply-To: <1bd2cc76-8dea-2d5c-792f-bece869d551c@fujitsu.com>
Hello,
"xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com> writes:
> Hi Cyril
>
>> Hi!
>>>> Did you try this?
>>>>
>>>> TST_EXP_FAIL(tst_clone(&cargs), EPERM);
>>>
>>> I don't try this because I remembered TST_EXP_FAIL only thinks the
>>> correct return value is -1.
>>>
>>> tst_test.c:1560: TINFO: Timeout per run is 0h 00m 30s
>>> utsname04.c:27: TINFO: Dropping root privileges
>>> utsname04.c:33: TFAIL: tst_clone(&cargs) invalid retval -2: EPERM (1)
>>
>> It's actually the tst_clone() that returns -2 if fallback to __NR_clone
>> failed.
>>
>> @Ritchie Is there actually a good reason why tst_clone() returns -2 on a
>> fialure? Can we fix the code by:
>
> I guess it is used to distinguish clone3(-1) and clone failure(-2).
> @Ritchie Is this right? Or you have other meaning.
Yes, this is how it is used in SAFE_CLONE to provide debug information
when tst_clone fails.
It's important to know which clone failed as obviously they do not
support all the same flags or features.
>
> Maybe we can use clone instead of tst_clone in this case?
I think just use the return value as it was intended and print which
version of clone failed.
>
> Best Regards
> Yang Xu
> >
>> diff --git a/lib/tst_clone.c b/lib/tst_clone.c
>> index ecc84408c..bacd269d9 100644
>> --- a/lib/tst_clone.c
>> +++ b/lib/tst_clone.c
>> @@ -39,8 +39,5 @@ pid_t tst_clone(const struct tst_clone_args *tst_args)
>> pid = syscall(__NR_clone, flags, NULL);
>> #endif
>>
>> - if (pid == -1)
>> - return -2;
>> -
>> return pid;
>> }
>>
>>
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-03-06 14:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 8:44 [LTP] [PATCH] containers/utsname04: don't use TST_EXP_EQ_LI for tst_clone Yang Xu
2023-02-28 9:06 ` Andrea Cervesato via ltp
2023-02-28 9:18 ` xuyang2018.jy
2023-02-28 9:39 ` Cyril Hrubis
2023-03-03 6:11 ` xuyang2018.jy
2023-03-06 14:10 ` Richard Palethorpe [this message]
2023-03-07 6:09 ` [LTP] [PATCH v2] " Yang Xu
2023-03-07 8:35 ` Richard Palethorpe
2023-03-07 10:16 ` 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=87bkl67xxa.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.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