Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1803057rwd; Fri, 9 Jun 2023 02:18:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MiYIybbfhIRhikMKJN+YJd/+yywMcIWZ+KzsS3FVeW1KCGrc3mm2HCIF6rHAiQ69TDH4/ X-Received: by 2002:a05:6358:ba86:b0:129:c8f7:c1a6 with SMTP id dg6-20020a056358ba8600b00129c8f7c1a6mr894232rwb.2.1686302339209; Fri, 09 Jun 2023 02:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686302339; cv=none; d=google.com; s=arc-20160816; b=CN6lEVCgD6uzl7//aG//uwQGHQh0uaJQFTBuaz1tyVZGeZPvXfCF5YFXPrRau9FXWj r2Qrf9HtoxB1MIts6iUFBKIJog20F7ARCr4D0KkmPdtZpbWbJT/VTV1KQZvG9cylld7C f3FkI0Mh9nsM2ghMLslFi1OmvpYUCbemnVGi0yBqOs1LBfhVaLsdTaukh79shbrUyBi1 AC1qmB7hhEUHxJVeQ7XWCggPBjLkqWEUvvfU6ZzB6XFvQ/qRjFEU/SKFv89d1iUt0qlT WTNCzR9x0bhtl7rxULSudN9ecrsY1NvxUbuPueg6Ep2YvkOUEw9Te80NNveoecC23hqc GKJQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a637e55000000b005481915c0c6si2067253pgn.31.2023.06.09.02.18.46; Fri, 09 Jun 2023 02:18:59 -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 S241375AbjFIJNj (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 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); -- 2.1.0