* [PATCH v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS
@ 2023-07-11 9:13 Tiezhu Yang
2023-08-17 7:22 ` Tiezhu Yang
0 siblings, 1 reply; 3+ messages in thread
From: Tiezhu Yang @ 2023-07-11 9:13 UTC (permalink / raw)
To: Shuah Khan, Shuah Khan, Christian Brauner, Thomas Gleixner
Cc: linux-kselftest, loongarch, linux-kernel, loongson-kernel
When execute the following command to test clone3 under !CONFIG_TIME_NS:
# make headers && cd tools/testing/selftests/clone3 && make && ./clone3
we can see the following error info:
# [7538] Trying clone3() with flags 0x80 (size 0)
# Invalid argument - Failed to create new process
# [7538] clone3() with flags says: -22 expected 0
not ok 18 [7538] Result (-22) is different than expected (0)
...
# Totals: pass:18 fail:1 xfail:0 xpass:0 skip:0 error:0
This is because if CONFIG_TIME_NS is not set, but the flag
CLONE_NEWTIME (0x80) is used to clone a time namespace, it
will return -EINVAL in copy_time_ns().
If kernel does not support CONFIG_TIME_NS, /proc/self/ns/time
will be not exist, and then we should skip clone3() test with
CLONE_NEWTIME.
With this patch under !CONFIG_TIME_NS:
# make headers && cd tools/testing/selftests/clone3 && make && ./clone3
...
# Time namespaces are not supported
ok 18 # SKIP Skipping clone3() with CLONE_NEWTIME
...
# Totals: pass:18 fail:0 xfail:0 xpass:0 skip:1 error:0
Fixes: 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME")
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
v6: Rebase on 6.5-rc1 and update the commit message
tools/testing/selftests/clone3/clone3.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c
index e60cf4d..1c61e3c 100644
--- a/tools/testing/selftests/clone3/clone3.c
+++ b/tools/testing/selftests/clone3/clone3.c
@@ -196,7 +196,12 @@ int main(int argc, char *argv[])
CLONE3_ARGS_NO_TEST);
/* Do a clone3() in a new time namespace */
- test_clone3(CLONE_NEWTIME, 0, 0, CLONE3_ARGS_NO_TEST);
+ if (access("/proc/self/ns/time", F_OK) == 0) {
+ test_clone3(CLONE_NEWTIME, 0, 0, CLONE3_ARGS_NO_TEST);
+ } else {
+ ksft_print_msg("Time namespaces are not supported\n");
+ ksft_test_result_skip("Skipping clone3() with CLONE_NEWTIME\n");
+ }
/* Do a clone3() with exit signal (SIGCHLD) in flags */
test_clone3(SIGCHLD, 0, -EINVAL, CLONE3_ARGS_NO_TEST);
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS
2023-07-11 9:13 [PATCH v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS Tiezhu Yang
@ 2023-08-17 7:22 ` Tiezhu Yang
2023-10-12 1:57 ` Tiezhu Yang
0 siblings, 1 reply; 3+ messages in thread
From: Tiezhu Yang @ 2023-08-17 7:22 UTC (permalink / raw)
To: Shuah Khan, Shuah Khan, Christian Brauner, Thomas Gleixner
Cc: linux-kselftest, loongarch, linux-kernel, loongson-kernel
Hi Shuah,
On 07/11/2023 05:13 PM, Tiezhu Yang wrote:
> When execute the following command to test clone3 under !CONFIG_TIME_NS:
>
> # make headers && cd tools/testing/selftests/clone3 && make && ./clone3
>
> we can see the following error info:
>
> # [7538] Trying clone3() with flags 0x80 (size 0)
> # Invalid argument - Failed to create new process
> # [7538] clone3() with flags says: -22 expected 0
> not ok 18 [7538] Result (-22) is different than expected (0)
> ...
> # Totals: pass:18 fail:1 xfail:0 xpass:0 skip:0 error:0
>
> This is because if CONFIG_TIME_NS is not set, but the flag
> CLONE_NEWTIME (0x80) is used to clone a time namespace, it
> will return -EINVAL in copy_time_ns().
>
> If kernel does not support CONFIG_TIME_NS, /proc/self/ns/time
> will be not exist, and then we should skip clone3() test with
> CLONE_NEWTIME.
>
> With this patch under !CONFIG_TIME_NS:
>
> # make headers && cd tools/testing/selftests/clone3 && make && ./clone3
> ...
> # Time namespaces are not supported
> ok 18 # SKIP Skipping clone3() with CLONE_NEWTIME
> ...
> # Totals: pass:18 fail:0 xfail:0 xpass:0 skip:1 error:0
>
> Fixes: 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME")
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>
> v6: Rebase on 6.5-rc1 and update the commit message
>
> tools/testing/selftests/clone3/clone3.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Hi Shuah,
Any comments? I guess this should go through the linux-kselftest tree.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS
2023-08-17 7:22 ` Tiezhu Yang
@ 2023-10-12 1:57 ` Tiezhu Yang
0 siblings, 0 replies; 3+ messages in thread
From: Tiezhu Yang @ 2023-10-12 1:57 UTC (permalink / raw)
To: Shuah Khan, Shuah Khan, Christian Brauner, Thomas Gleixner
Cc: linux-kselftest, loongarch, linux-kernel, loongson-kernel, Andrew Morton
Cc: Andrew Morton <akpm@linux-foundation.org>
On 08/17/2023 03:22 PM, Tiezhu Yang wrote:
> Hi Shuah,
>
> On 07/11/2023 05:13 PM, Tiezhu Yang wrote:
>> When execute the following command to test clone3 under !CONFIG_TIME_NS:
>>
>> # make headers && cd tools/testing/selftests/clone3 && make && ./clone3
>>
>> we can see the following error info:
>>
>> # [7538] Trying clone3() with flags 0x80 (size 0)
>> # Invalid argument - Failed to create new process
>> # [7538] clone3() with flags says: -22 expected 0
>> not ok 18 [7538] Result (-22) is different than expected (0)
>> ...
>> # Totals: pass:18 fail:1 xfail:0 xpass:0 skip:0 error:0
...
>>
>> Fixes: 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME")
>> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> ---
>>
>> v6: Rebase on 6.5-rc1 and update the commit message
>>
>> tools/testing/selftests/clone3/clone3.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>
> Hi Shuah,
>
> Any comments? I guess this should go through the linux-kselftest tree.
>
> Thanks,
> Tiezhu
>
What is the status of this patch?
https://lore.kernel.org/lkml/1689066814-13295-1-git-send-email-yangtiezhu@loongson.cn/
This is a ping message, maybe you have forgot them?
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-12 1:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11 9:13 [PATCH v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS Tiezhu Yang
2023-08-17 7:22 ` Tiezhu Yang
2023-10-12 1:57 ` Tiezhu Yang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.