Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1111861rwd; Thu, 18 May 2023 08:06:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ri1e06hWFWE6M1kOFgHnJ68ftgeuiupPMN4v3lfBO9t1y1giJ8N3yJnuVqUE26htoUqIm X-Received: by 2002:a17:902:f551:b0:1aa:fbaa:ee01 with SMTP id h17-20020a170902f55100b001aafbaaee01mr3480600plf.48.1684422412858; Thu, 18 May 2023 08:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684422412; cv=none; d=google.com; s=arc-20160816; b=0bP5uu2tgy/0dNKjBGcMUefErprihvgJ6CQ+XjOBxqtZw31chEY3C0CGW9fWohcNnW pDdvK3CptWOzjGcs1SX9GiQFwWOt4oCwzgipuhxY+HjII4W/hCbqw0M0lNFyz8PMOIyf 7dn+HxuoxV305WZuv5BZUbJ+rGmfu0ytOBBiHvz0sRKciHH7uC29KEQelC76fS36P+Oe Nwzy5XbxImdKBUqOAl0i5Khbz8/qoVDD5SDn4PMEaToezWkWcXjBUrdifhUql8LbkBaX X+qtZOz8cKss6qsiimWB1UVmSNrHlaDd5ZkYVLAolb/+MLTC034BLjR529kS/O6RPBRa qxmA== 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=lmiBsxu6IpQ5DP4MOLZCDqS97BP0rOQxG9BiDkTXF3nK5tM6mf1l0nYJhAfnuGS9bS U3ayLuEqN8msZUsPrW2pbW6g0xe+t6ZqH5bovF3SNPA1d362O74riOt6UFBQ8stvSX6I 4qyC82Agh1oF/3UmDMi7QPVC9utUKpxlqOasnQjZ4kv7215NOjP4CL7jgBbqC75wsCJn eNq+/2Fo6nGK1KVbYoy0Km/tew2ZwuQ2F+Z/Ku6iDnzWugnRtD7orkIP60AFeMofSQfq AHf7KHNS1NTRZ/zb6m8HmM7mZewd1lDZoMclQUokRtX1sT7ILrVEzP9IkqCz/PxdlpLE e8Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ccgs9cWE; 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 jb18-20020a170903259200b001a29280c544si1430040plb.263.2023.05.18.08.06.39; Thu, 18 May 2023 08:06:52 -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=Ccgs9cWE; 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 S231819AbjEROz5 (ORCPT + 99 others); Thu, 18 May 2023 10:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbjEROzf (ORCPT ); Thu, 18 May 2023 10:55:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97F6519C for ; Thu, 18 May 2023 07:55:29 -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 7888864FE8 for ; Thu, 18 May 2023 14:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD3E5C4339C; Thu, 18 May 2023 14:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684421728; bh=UfezgJW4qV6A3Fx5ZwnvEgO/thFwlCGX/qvaitn6eGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ccgs9cWEvcgjUxlizOqSW2qLhQvu4CQM3HFH74ASRei1MxE7NieaGI2MLXNKikNIS b7ygBM1wjd8gEpNNZI+iPGiglqRVAjhEnOCF3v/FTLo5RPLwYlb8lpBunbnkWLwDOR xy3LEj7n7Sa2yDPphgbPw/a46XGNBZCX76H1T2lZ419unUVXvRP04/loMs1ikPFXTH 3Pu2ucfZedAtFIjzawBzQD0L+Gtpf8Gsg/qvWARFHunVx2BDTIaqHB5OyieeSXYLRy tkXs6Wvwa6p51yji9LUDOKX9o+Wc49Bvj5e3JajpUnXE4q5yA7iQfLe/R32GdK/Ov9 UA0CUjY+Y7TPQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 32D43CE1C2F; Thu, 18 May 2023 07:55:23 -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/15] tools/nolibc: add testcase for fork()/waitpid() Date: Thu, 18 May 2023 07:55:20 -0700 Message-Id: <20230518145521.3806117-14-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <4817a4dc-69e6-4937-84d5-f2f630ff646c@paulmck-laptop> References: <4817a4dc-69e6-4937-84d5-f2f630ff646c@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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,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