Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp319294rwd; Mon, 12 Jun 2023 14:09:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pnyTFFgeJ75rm9jQoofCM4rQUog8nY8XPlBlqxbPcyedL9zU3XfUmBkIaX96NO3nOr/BA X-Received: by 2002:a17:906:99c4:b0:974:6216:8dd2 with SMTP id s4-20020a17090699c400b0097462168dd2mr12795055ejn.27.1686604168202; Mon, 12 Jun 2023 14:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686604168; cv=none; d=google.com; s=arc-20160816; b=YntWePuziG3+kK3TcSS7EUDAj6XHzIqpT9znjZ8RlMUHqKaj7j5Z9fedx8u7Mq6NdY Po8siZ8A4uFenqTPmqNqFQF1k3rHC48iawMMhjOh9S7BJhxHuh4iw1G0RivmUVjxjInd Cv82jAimbAMT5s7fDRLeVFDbYnO21asm8A6wDVN7sRdfcNAvk64qZnb742WXck8F/P/9 KkqxMX8rEcmNITy0jSkQ3yjY7qRWjSLkc9FqqTF+QHhahs4fqf2MpSs3zNszZxMS1g1v LFt6JnRzWOAphlY73cROA5lztYsMTPtc7jfyeEK3y9WpzhRGNGnw83A3DT4GdqY2z4vZ asuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+ZonSiidB6UCMuPN1gP+PAa2wlMByf9ASWe7cGDyb9Y=; b=xE/qrQOKgW/YgCUOH4L8pNRAHTIOjVorH1se32A0oegheD4WxkLpoMiTHQbZ2eIkCD tOacE/JZzQMjYGjco6f4JQUF4MtswbqZUYq5plUXdanwiVRPn+gf6DRgUrUuSzeCmAwi qkSi+75XPNMWaD6DqAcGiggtL6bPkyopJhds5zNqE2YSCqJTltkc+znTSSQPy374I89E 4LaIb5XsGeTlJxEzO1pRmstRcDpg4LZ0NbOhXIuiygwrxgVq9FJaDblyvnijXzUhPOG7 EfeFvYIF6E2fZCa68DETRmkOoA19hnSyLrA/ZbrI+7BHEfdlSFpKovKrygpFheJuVarq 2fiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u15Yhmho; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a170906409500b0096f6a911f9esi6220640ejj.249.2023.06.12.14.09.01; Mon, 12 Jun 2023 14:09:28 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u15Yhmho; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236971AbjFLUsP (ORCPT + 99 others); Mon, 12 Jun 2023 16:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237076AbjFLUrC (ORCPT ); Mon, 12 Jun 2023 16:47:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0FB2949 for ; Mon, 12 Jun 2023 13:46:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 786E962EF7 for ; Mon, 12 Jun 2023 20:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADF81C433A1; Mon, 12 Jun 2023 20:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686602716; bh=UfezgJW4qV6A3Fx5ZwnvEgO/thFwlCGX/qvaitn6eGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u15Yhmho/ODVrrDCvteOLPvwc4BoC7BhZuidW45OCP0Ox8Qcc0UnW89wIiPTVmhS+ E06JhpTd0YLubxzyAcTmWxeb3LAzZ85q70nNN6gvFor/kZ96/0YXPX4lWiZurjsAyd akUsvrdWBpMHiLCOnthz07eHsYPU6IFBymefVkJHzhInWyE56KXdTd/QOOwWqBLBar gjSihqsRW15ZNowwcOdI8bprRNm1f7gH7qIdb/gSnNPtxozISUYB8LiPEtxtedpt/k 6LvEuQ4cxEKEfusaWM+gdo3ncIhz0S9ZkgGTT+yvgiKVqNHHEP1M1FiLH9XlbSgxjf OMz1fX0AEAF+A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C88CBCE3A55; Mon, 12 Jun 2023 13:45:15 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@meta.com, w@lwt.eu, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Willy Tarreau , "Paul E . McKenney" Subject: [PATCH v2 nolibc 14/53] tools/nolibc: add testcase for fork()/waitpid() Date: Mon, 12 Jun 2023 13:44:35 -0700 Message-Id: <20230612204514.292087-14-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> References: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Thomas Weißschuh On s390 the arguments to clone() which is used by fork() are different than other archs. Make sure everything works correctly. Signed-off-by: Thomas Weißschuh Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- tools/testing/selftests/nolibc/nolibc-test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index f06b38cfe38a..f042a6436b6b 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -474,6 +474,25 @@ static int test_getpagesize(void) return !c; } +static int test_fork(void) +{ + int status; + pid_t pid = fork(); + + switch (pid) { + case -1: + return 1; + + case 0: + exit(123); + + default: + pid = waitpid(pid, &status, 0); + + return pid == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 123; + } +} + /* Run syscall tests between IDs and . * Return 0 on success, non-zero on failure. */ @@ -530,6 +549,7 @@ int run_syscall(int min, int max) CASE_TEST(dup3_0); tmp = dup3(0, 100, 0); EXPECT_SYSNE(1, tmp, -1); close(tmp); break; CASE_TEST(dup3_m1); tmp = dup3(-1, 100, 0); EXPECT_SYSER(1, tmp, -1, EBADF); if (tmp != -1) close(tmp); break; CASE_TEST(execve_root); EXPECT_SYSER(1, execve("/", (char*[]){ [0] = "/", [1] = NULL }, NULL), -1, EACCES); break; + CASE_TEST(fork); EXPECT_SYSZR(1, test_fork()); break; CASE_TEST(getdents64_root); EXPECT_SYSNE(1, test_getdents64("/"), -1); break; CASE_TEST(getdents64_null); EXPECT_SYSER(1, test_getdents64("/dev/null"), -1, ENOTDIR); break; CASE_TEST(gettimeofday_null); EXPECT_SYSZR(1, gettimeofday(NULL, NULL)); break; -- 2.40.1