Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp671553rdb; Thu, 19 Oct 2023 16:09:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6r6/BKszM1f+vnjcR+JUb6F3pgmWBCli4w9mhUxkgZX1YvXVn7fLcbPHLgyslbiQgzEIP X-Received: by 2002:a05:6a20:6a1f:b0:15e:7323:5bf3 with SMTP id p31-20020a056a206a1f00b0015e73235bf3mr4653218pzk.26.1697756965006; Thu, 19 Oct 2023 16:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697756964; cv=none; d=google.com; s=arc-20160816; b=tSdAFAELJJyQXmTedFhTYYzdpzk7ajACQ/rwZg8oaae8ELLCQnpqj/CFYwBgmmDuiZ Ko1gjk2noGwSIegqr7rnbVV5FyAx9zNxqijWp5T1BpHRRl/lq/QFzto5+CYMINYkTIJn XWxy7ecC4+eR6wApL5Ga9YIMat/ie/26jbMwXRcL7ntujyrrNs385rnS+MHwA48xrUfS Iunk85N/v5j521BqBzqRcBkCvAgTdEGRcFWJla/R0P8DDIiVT8XyZ+MhfMSy1fnpVSEa 1Y5UNHTp4OBgBjcaLcqCcJB5WIfVvX1hv3r8vajCbsZEq669dAozxfui7JhSeKjVy6mn qN1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=svbr9EcSV5Rh3251HDJXRPix7Rm2W/dw6FOhYBmqH54=; fh=Mh1N8sYZwiVGIsxpC7Ji4/Jj/nGrq6BpFoG3IqUR6+M=; b=ublaNzTJauzYuSkmyxBhCBoxfuj5xLn7Xr4SUDU01pKVS3H3JcfCTzGQr9SSeyjf68 AUOSuBJtNn3G9pMGuaGwMTancIzIn1lwfoKDOFm7XFVglH8mDc15CZgdfQGVXJMhDDbh FvU/Z33ZLW361UQGHv9xLD0LCum471/i6z/xtS4TWiPLILKTP2m3dTpNwoltDD1eVc89 Ll13ABCtb430nRclf4LMXMyyADONqKZW80QnRwc5iVidt0Tc9mHM4sF0Li4nPEnhljhu jL9l8Qe3jBCqJjRjUjAVEPOpWAcgtvsyJ07dTObDFmXSIDFiaY1fUCuPLBSml8COGGT4 VCEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iaONNIo4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b69-20020a633448000000b005ac13df150bsi545550pga.594.2023.10.19.16.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 16:09:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iaONNIo4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1D6EB8282A30; Thu, 19 Oct 2023 16:09:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346709AbjJSXJR (ORCPT + 99 others); Thu, 19 Oct 2023 19:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346702AbjJSXJO (ORCPT ); Thu, 19 Oct 2023 19:09:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F6D6106; Thu, 19 Oct 2023 16:09:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 179AFC433C8; Thu, 19 Oct 2023 23:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697756949; bh=8yGOMG36olUp/akMh6rkuC0OaLA9uG3cci6pDHR/HKQ=; h=From:Date:Subject:To:Cc:From; b=iaONNIo4GXEAc6LG9sii40eI0VJA2RVDByIZU2NBnbRR8wwh6qRYCrHRLUZRXioIA Xa0P6ZNX4g07KD2y4SmAVbVPVLlbOVcNFnSy34jQFLa88Yqv3NjHmGumKlq0Erxe0E 3/c9dV7mYCly5QMt9ZfDzHDdLpY1jPCrBeEocsib7exqqDjEyq+7hvljuaQTVZN09I 0V4NvQjygZ3z87xeUo31vtHRtu1PW0BR65RvQWTS9fdPNpvC955rJHHyHByWFAPZy7 ASU67y0TyXT6e9obouXjYDsVRAqcc99aGEOQ24VDlRFJ4Ggnk29bfYC0/woqVgp8qT 3mhd0mjN+/8Ng== From: Mark Brown Date: Fri, 20 Oct 2023 00:08:12 +0100 Subject: [PATCH] selftests/clone3: Skip new time namespace test when unsupported MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231020-kselftest-clone3-time-ns-v1-1-31a17e072a05@kernel.org> X-B4-Tracking: v=1; b=H4sIANy2MWUC/x3MQQqDMBBG4avIrDuQGGlsr1JctPFPO2hjyQQpi Hc3uPwW722kyAKle7NRxioqS6qwl4bC55neYBmrqTWts8beeFLMsUALh3lJcFzkC07K3pnXNXa 298FTzX8ZUf7n+jHs+wF42ZOHagAAAA== To: Christian Brauner , Shuah Khan , Tiezhu Yang , Tobias Klauser Cc: Thomas Gleixner , Andrew Morton , Stephen Rothwell , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=2679; i=broonie@kernel.org; h=from:subject:message-id; bh=8yGOMG36olUp/akMh6rkuC0OaLA9uG3cci6pDHR/HKQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlMbcRep0GTdt5oyAi825blRZSaZH7USK88m/1E3BS UKczc0iJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZTG3EQAKCRAk1otyXVSH0KW5B/ 4u8e3wydjWCGQEJ3+M0KT+Tky+F6+CuKDBXeJActy6lTbpjsKP5MvRhI503Z8alJVCI81xegAC7cHM MaE+/vltgmRHlkdGi2s5BQbMYNK1kIbopX6ize2XAsNiZC8sIW3ReK35Q31Lceoak625eN4vldBm9S cYLl9UEeddxNPUK1f2xexmxZxtF2XEsOILhROPVrBp38eWJWniFqORJN11gRqLQN+1KZ9gjSkm5j33 YnPGKeDF8Odw7ARshA4dcIJujm1VTECf7dFf4fZucQC91yLKDWbvJvbzoMP3qc7EPl0Wq5l/XNAm+l AdrJhF54FmtsHvR31M0FNCdYBfBewg X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 16:09:24 -0700 (PDT) Use a filter function to skip the time namespace test on systems with !CONFIG_TIME_NS. This reworks a fix originally done by Tiezhu Yang prior to the refactoring in 34dce23f7e40 ("selftests/clone3: Report descriptive test names"). The changelog from their fix explains the issue very clearly: 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 Original-fix-from: Tiezhu Yang Signed-off-by: Mark Brown --- tools/testing/selftests/clone3/clone3.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c index 9429d361059e..915846bc32cc 100644 --- a/tools/testing/selftests/clone3/clone3.c +++ b/tools/testing/selftests/clone3/clone3.c @@ -138,6 +138,16 @@ static bool not_root(void) return false; } +static bool timens_unsupported(void) +{ + if (access("/proc/self/ns/time", F_OK) == 0) { + ksft_print_msg("Time namespaces are not supported\n"); + return true; + } + + return false; +} + static size_t page_size_plus_8(void) { return getpagesize() + 8; @@ -282,6 +292,7 @@ static const struct test tests[] = { .size = 0, .expected = 0, .test_mode = CLONE3_ARGS_NO_TEST, + .filter = timens_unsupported, }, { .name = "exit signal (SIGCHLD) in flags", --- base-commit: 8d4099dd0727acfc8b0f644eacaf852f9d5dc649 change-id: 20231019-kselftest-clone3-time-ns-730b6f4187c7 Best regards, -- Mark Brown