From patchwork Fri Jun 9 09:07:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 105456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp813927vqr; Fri, 9 Jun 2023 02:16:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Yx4xUWooynDLTVMKMktZXYoLhoT1gu1NVbYyLWRVikNH3kqMUaSkVaBXhRmC51Qm026cv X-Received: by 2002:a05:6358:9f89:b0:129:bb4d:1286 with SMTP id fy9-20020a0563589f8900b00129bb4d1286mr799545rwb.25.1686302180437; Fri, 09 Jun 2023 02:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686302180; cv=none; d=google.com; s=arc-20160816; b=neh7NDyw1KtUKKBKko6t6q0s3kK7Y2prJqPTOzfne2uYKU+84IoEnYPL2uVpH43kpx u1wLcjOl1ffb4zgPH829G4u3T5yC1sfy667sK6WbM+7xIUo1n6iy8dtLPYZoU+HbKfAs Tk9OHqyhD5nl30jmNROjAbEtPGsqhuImAGPVdUg/bq3aaYMAYj2HY1JbcCocU/7YwuN3 kej6ZdR4tHUaEn3DkcXTFmBoFtb52KnLJeGDMjnm++Dg16EKpsN9tKdMPTjNpGXw+bns 1/Lw5axHLa/Jx7Mevdf1lEZ+u9RaWaiJjL8mbyEUPHDabduBt+OslY9Y+RGkQceeL1Rn ygrA== 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=qdMiKGLuV4fI0bAxdWHtl8IuC4nydO5LUGltSu4Ulqo=; b=OjX12Ti8B11XJl08vC4EZI9nuDiSUI4rsNWfP7jXlKgA6N5hbxFHkYiDe6vgyo4csD xdWFdSQjjKyMz/Ex3hEVWKau/6T0h4UsGAOFM6/xnAgs1etU8y1XKZPd+1V23toVep1R LwewB3PSFncUpQehLGv8GWmBCjyb3/7MENgRW+PmgcTseRD9TBM8f71gHtOX7DA36Sde wY256/mZBz0NgA6IeSjgdixx6aWHbMOvFvSK18whWKtUHe6Rah2Zji4mAoyppZBZzcBU tPDteeHzrLsoOlfYfLuzkcv9il11JKbqnlFALP58l9mxY/CW3BedXtD4/ngHEILErnZX PIUA== 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 z67-20020a633346000000b0054090604644si2383849pgz.317.2023.06.09.02.16.07; Fri, 09 Jun 2023 02:16:20 -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 S241061AbjFIJNj (ORCPT + 99 others); Fri, 9 Jun 2023 05:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240463AbjFIJNR (ORCPT ); Fri, 9 Jun 2023 05:13:17 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F8724EE6; Fri, 9 Jun 2023 02:08:54 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Dxi+rJ64JknfwAAA--.2936S3; Fri, 09 Jun 2023 17:07:21 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxVeTG64JkiHMKAA--.31757S2; Fri, 09 Jun 2023 17:07:19 +0800 (CST) From: Tiezhu Yang To: Shuah Khan , Shuah Khan , Christian Brauner , Thomas Gleixner Cc: linux-kselftest@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v5] selftests/clone3: Fix broken test under !CONFIG_TIME_NS Date: Fri, 9 Jun 2023 17:07:05 +0800 Message-Id: <1686301625-9477-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8DxVeTG64JkiHMKAA--.31757S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7Kw48Jry3JF4kZryDJF1rXwc_yoW5JFyrpF yxZw1DKFWFgF17tFyDZ3yqgFyrCF1kXrW8XF47Z34UAr1fXr97Xr4xKa48JryUKrWFvrWF yFyfGF4xWr1UXagCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Fb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2 KfnxnUUI43ZEXa7IU8uuWJUUUUU== 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768215995323758150?= X-GMAIL-MSGID: =?utf-8?q?1768215995323758150?= When execute the following command to test clone3 on LoongArch: # cd tools/testing/selftests/clone3 && make && ./clone3 we can see the following error info: # [5719] Trying clone3() with flags 0x80 (size 0) # Invalid argument - Failed to create new process # [5719] clone3() with flags says: -22 expected 0 not ok 18 [5719] Result (-22) is different than expected (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: # cd tools/testing/selftests/clone3 && make && ./clone3 ... # Time namespaces are not supported ok 18 # SKIP Skipping clone3() with CLONE_NEWTIME # Totals: pass:17 fail:0 xfail:0 xpass:0 skip:1 error:0 Fixes: 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME") Suggested-by: Thomas Gleixner Signed-off-by: Tiezhu Yang --- v5: -- Rebase on the next branch of shuah/linux-kselftest.git to avoid potential merge conflicts due to changes in the link: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=f8424c54d041 -- Update the commit message and send it as a single patch Here is the v4 patch: https://lore.kernel.org/loongarch/1685968410-5412-2-git-send-email-yangtiezhu@loongson.cn/ 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);