Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2232863rwe; Sat, 15 Apr 2023 14:47:57 -0700 (PDT) X-Google-Smtp-Source: AKy350bzkvwMqfBfSUrUipEPP+urgM8PtuSfYxH3upn2jtxB/IOrDIa2CS/dxaO7NY74HAXCMAJ3 X-Received: by 2002:a17:90a:8414:b0:247:2a81:df03 with SMTP id j20-20020a17090a841400b002472a81df03mr8888507pjn.7.1681595277110; Sat, 15 Apr 2023 14:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681595277; cv=none; d=google.com; s=arc-20160816; b=faQ+V8iKQdQcbOvCYJdrjHQdV0qez3ca0mg1DAJVXi9Rvp/aCXgSMSjbNpkPs/CEPE PB6zOnriWNHx9JWXv1hgzQMAi/DxQHOLRsZD+JOrL1/0sVmyYK8fXzP5YIlZe8o9C0QC peV+afuaDvX5aQ9OBb7TZI90apMZbHxtCpo32XgBqYHbo/nN5uW4p+LxRsr6NzJE7LA5 M6LT5C1yRvVGwLW1UpIZV4Xn8MvpDePAiinbtxSlsP69hl94zYXH8oMscCz5AQ/7aO4v LH5PM+HPfFoIrd8ulvrU+Rg1c7tWdEux/FMMbRDGMIYhTgcfpwbL/EHsljOPfD6CFttd 29Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:dkim-signature :from; bh=NK5TwJBg+cIw7nGAtJ39uiFgf2UCR1gADF3F4+BkPGI=; b=qrfX8+g7LF2nfcEfsny6bfzZZU9VCe/GkcxfQ2nNnQPAkcl9Tk5qQQfQsU+0hE1ZeO QFUQTeCg7XKTx50XqKOPhdRApkZO48JFLigG7BUrvJFkBtn7LAhfFW2CLW8DkHAhd1dk 7gpBMvBv8YqK+dhT9p0QGgiJKMs41kxWsrvacJIMZO/ffSRkzzifGEEO0Z/bgFrCsGGE 3daEPcWY+duxMRPjltS570YQ0mc9G0rzT4VERiIioiSCJQrbnEpOSV91B/qAN0UofE5n 9cvBSPTTH7Vf4Srlkp41kG0ICGN6RwgODUt7ZKx+K1lA0lggvoSR6TGxFBCVIfVjsb7e Imag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=Snq8rnmG; 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 p14-20020a17090a4f0e00b0023d02932015si10494174pjh.40.2023.04.15.14.47.41; Sat, 15 Apr 2023 14:47:57 -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=@weissschuh.net header.s=mail header.b=Snq8rnmG; 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 S230058AbjDOV24 (ORCPT + 99 others); Sat, 15 Apr 2023 17:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjDOV2w (ORCPT ); Sat, 15 Apr 2023 17:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 615AA30C3; Sat, 15 Apr 2023 14:28:50 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1681594128; bh=Serav5NsrGD7AG0O6Mn+YtgEHgPcj/qioSXyB4VmbSc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Snq8rnmGEhznB84w1h1GMX2CCLnPQiQYZsr7CzHsiLIF0csWLWmOE5ELA15vljlvC s46bmjPStN3vU9wE2zoXbsvn8jXtSdqRvPv8bz/7Wzn1It6pIsB8hDZSumyA7CR067 HSfD1ctfwSw8qR5Krd7KchDszRkk2CAawuIgB+7g= Date: Sat, 15 Apr 2023 23:28:48 +0200 Subject: [PATCH 2/2] tools/nolibc: add testcase for fork()/waitpid() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230415-nolibc-fork-v1-2-9747c73651c5@weissschuh.net> References: <20230415-nolibc-fork-v1-0-9747c73651c5@weissschuh.net> In-Reply-To: <20230415-nolibc-fork-v1-0-9747c73651c5@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1681594127; l=1787; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Serav5NsrGD7AG0O6Mn+YtgEHgPcj/qioSXyB4VmbSc=; b=CpgzObVEN4lDAf4txDLUIMfLrZ7bQE/nT95ucHYkuVj5n26guKfZ+O3iP0qg8Ub9+Ilj6WS7g cpuzD12N0V7C5TkrMonxcca/bN3j+hm4BHn81dgd4x4FEoZOr1noMTW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 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 --- 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 888da60eb5ba..d294338cf141 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.0