Message ID | 1689066814-13295-1-git-send-email-yangtiezhu@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp347850vqm; Tue, 11 Jul 2023 02:24:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlErOlw0TkfhnJnEJmnc8RvIHaEsXuNAfBBy61sdLbLM1F70u1dAlXzy7LZZ2baiybYvyTks X-Received: by 2002:a05:6808:4296:b0:3a1:e282:8405 with SMTP id dq22-20020a056808429600b003a1e2828405mr13418759oib.13.1689067463007; Tue, 11 Jul 2023 02:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689067462; cv=none; d=google.com; s=arc-20160816; b=qKol4eYUwy50zIATOPY2RDR6+U5wZwFn7Fs3W4K5wGyWRxn5meficYtWgOuoFtxW6H mQWoq+Ye7LblhJ6+bPciWvXPjMfEM+0W9h4ayXa2c2Y8XCj61CWrk3q+LJja9e6uzEcL t24iiMSCRQ4wHEqKFVrAZIt4Ox51QEhPwOY19M2D7Hmfa/9cAJ9Fs6HUrDMCeGdj//lg 5qHAORjYBUQRwp1WSnThJKAYuHft/WchjiWyUQWHJ20To0eMzee4Gzzqxc//FfQ/tzSv Ur1Urrj4w2CvXPkyla4lK4ggN5Nld0X7fCiX0M171rvsWWIV6SDTIJBEUUUZXt9pg4pK 6e+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=iIe/VZtzbyCIbBrFiINhNNSCqWuBVzu5ruvongzlMRU=; fh=nRd9lNk4gTDjXGD+gjqhP58lKVNFwJ0oSwj/t19PgQQ=; b=UDRb42Vfg1og86cXXdWoF5nQ4PL+Qxkpd5C9hnS8t7boc82vzQQPs96+G9yqZ7Omki R4LY8/gcS2PDC+hd4wko96iaxkILUja1+wpDPpRBT/eSY4oMjOcxIV6Kaejd3iEWK2Gs ZQtGdu2bgsGbjS41ROxjkwc/5OM2MBdxI9LUc9LdfNOq0/O1UDLzyyzt63/H3ZmKrq52 /QH0J43hs+NTg5PRO4+SjEfYlWSgYHloTFIrDCwJKgOLuBbhJI/QxOzzMwcLiMBVX4Qm t5jnY/BiHkWX5OFRA/kC7kRI1X86r/pZr67UCvVF+lzWfEbuGhIQLsjGDWL5tO1HSFGM BVoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y26-20020a056a001c9a00b0066aa7b0e3c8si1163644pfw.322.2023.07.11.02.24.09; Tue, 11 Jul 2023 02:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231348AbjGKJNt (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Tue, 11 Jul 2023 05:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbjGKJNr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Jul 2023 05:13:47 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F81D10A; Tue, 11 Jul 2023 02:13:43 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Cx2epFHa1kJHIDAA--.4690S3; Tue, 11 Jul 2023 17:13:41 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxvM5EHa1kgHAoAA--.49364S2; Tue, 11 Jul 2023 17:13:40 +0800 (CST) From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Shuah Khan <shuah@kernel.org>, Shuah Khan <skhan@linuxfoundation.org>, Christian Brauner <brauner@kernel.org>, Thomas Gleixner <tglx@linutronix.de> Cc: linux-kselftest@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS Date: Tue, 11 Jul 2023 17:13:34 +0800 Message-Id: <1689066814-13295-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8CxvM5EHa1kgHAoAA--.49364S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7Kw4UZr1xJFy3trW7GF47Jrc_yoW8trW5pF yxZw1DKFWFga17tFyDZw1qgFWrGF4kXrW0qF4UZ34UAr1fWryrZr4xKa48JFyUK3yFv39Y yFyfGF47uF1UXagCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUB2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVWxJr0_GcWln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12 xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r12 6r1DMcIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64 vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_ Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E 14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUxYiiDUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771115603895214007 X-GMAIL-MSGID: 1771115603895214007 |
Series |
[v6] selftests/clone3: Fix broken test under !CONFIG_TIME_NS
|
|
Commit Message
Tiezhu Yang
July 11, 2023, 9:13 a.m. UTC
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(-)
Comments
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
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
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);