From patchwork Sat Dec 21 14:44:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13917867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AA39E7718B for ; Sat, 21 Dec 2024 14:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rtLPk3JSKon8qPGBVPYQ/OeibFbD9wggjNRFFZ0addQ=; b=RMg1aK0YGZrzXF 83maO1A8mu+KYXtOlIojM7oVO4ljRrEbmHXQh7S6qBuQplHH0e7J6y84XT4UhcJ6kCl5gaUtAWDDs NY+EQcDb9JsslN7zBfpRFCEw71MniOF1z+hE/6+AGY5jgIgBsIICiVdwo4PGfRz8LTBRMLEnJZek8 itaDEWkJQ7/vGPGAttNfiuN2uepetTV9zwxhQNI6DF5Zlats1UIv8i+3nA8dEE0bpqo22bYpArVdF ef4v0LhTRBobFwtS/pcPWHtZWdhQu17LcjOUWstBqTzyhyAbZTvfIEKQbmzoJbLrDDmaTc6BGKqnS PU80+uS9HPPzUpdCwiEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tP0ih-000000074kx-0jH8; Sat, 21 Dec 2024 14:44:43 +0000 Received: from todd.t-8ch.de ([2a01:4f8:c010:41de::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tP0ic-000000074gX-1XWS for linux-riscv@lists.infradead.org; Sat, 21 Dec 2024 14:44:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1734792272; bh=nj0Jq2wR9LzNkifobwaqgqXXDXIUpTLkrlfLIfSBrB4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qlYyNW/izxCwfFi+f66Ru0I8+DJsNe4VI5K+fVDh/dW7IvmATed3cwBw4PqoiW2RK nRwH8DmOTcq334Zcjbx24G7FaJV3tJhMvCwuQi1xNZ03ETZz3yPX1I63rvfy8zmSUs Hg7mfMhSeLDztySrOWH0RwKshbp9f8lGc1urPlNI= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 21 Dec 2024 15:44:29 +0100 Subject: [PATCH 2/6] selftests/nolibc: use waitid() over waitpid() MIME-Version: 1.0 Message-Id: <20241221-nolibc-rv32-v1-2-d9ef6dab7c63@weissschuh.net> References: <20241221-nolibc-rv32-v1-0-d9ef6dab7c63@weissschuh.net> In-Reply-To: <20241221-nolibc-rv32-v1-0-d9ef6dab7c63@weissschuh.net> To: Willy Tarreau , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734792271; l=1420; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=nj0Jq2wR9LzNkifobwaqgqXXDXIUpTLkrlfLIfSBrB4=; b=nvClkbgo3WfomII9Gy/xuFDJ9bB9UMA1pDy2NmiSII3/8wtxOEGKSgH4f7omKIQ1AdzBh90WO KikHBwUy9gaDVBG4QiL3SWkr/UlaGwLPzeAQUIDgyz+zlaJNiyN5UwW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241221_064438_577883_F4FE123C X-CRM114-Status: UNSURE ( 8.05 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Newer archs like riscv32 don't provide waitpid() anymore. Switch to waitid() which is available everywhere. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 6fba7025c5e3c002085862fdf6fa950da6000d6c..60c50968d3630e4909a5ecb2400770baaf7c2add 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1323,7 +1323,8 @@ static int run_protection(int min __attribute__((unused)), int max __attribute__((unused))) { pid_t pid; - int llen = 0, status; + int llen = 0, ret; + siginfo_t siginfo = {}; struct rlimit rlimit = { 0, 0 }; llen += printf("0 -fstackprotector "); @@ -1361,10 +1362,11 @@ static int run_protection(int min __attribute__((unused)), return 1; default: - pid = waitpid(pid, &status, 0); + ret = waitid(P_PID, pid, &siginfo, WEXITED); - if (pid == -1 || !WIFSIGNALED(status) || WTERMSIG(status) != SIGABRT) { - llen += printf("waitpid()"); + if (ret != 0 || siginfo.si_signo != SIGCHLD || + siginfo.si_code != CLD_KILLED || siginfo.si_status != SIGABRT) { + llen += printf("waitid()"); result(llen, FAIL); return 1; }