From patchwork Fri Jun 30 14:50:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13298291 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8548DEB64D7 for ; Fri, 30 Jun 2023 14:51:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232159AbjF3OvZ (ORCPT ); Fri, 30 Jun 2023 10:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbjF3OvY (ORCPT ); Fri, 30 Jun 2023 10:51:24 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF7199; Fri, 30 Jun 2023 07:51:20 -0700 (PDT) X-QQ-mid: bizesmtp75t1688136671tks53y7u Received: from linux-lab-host.localdomain ( [119.123.131.49]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 30 Jun 2023 22:51:10 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: ILHsT53NKPhtX0qqQD3e9uQe+zph/w5hvXojtfrw04MKncxuDc5m83pLdsrLg 1voBQJq/KkY5cjRgJe6tncXcvlA4E09cKSck78NCzB9n+Mzg0TGmgwg9ZCX3hNi63/BUbv3 s694W/9//VoR66wOD3HOqNdNHW0+QgIIfdywvw6Fjg+tnldOCOA4HDG2j3QgfErB1gnDOIK I2sB26OYEYTtlhDwXoYLrPpEZ2J9Znbg4zMPKjlkW7xgG8AcssfXtAb0J4JsHhye9/8O3Ji EULTdX+5eP+DhysMLoDuyzvPk38li457EyiNKrLfZaJhoHnPhpFH9dg/IUAYBIxITjUX4iU Zzew+gU3S97jWYdLfZqMvAno6R+MR1cdNB0V7OJX69VG+c1XLejGkeyxN3jQA== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8120028281936275689 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 07/14] selftests/nolibc: chroot_exe: remove procfs dependency Date: Fri, 30 Jun 2023 22:50:10 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Use '/init' instead of '/proc/self/exe' for CONFIG_PROC_FS=n. If '/init' is not there, add ENOENT into the errno check list. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/nolibc-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 3e2e808e06c2..a7a4310dec3e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -702,7 +702,7 @@ int run_syscall(int min, int max) CASE_TEST(chown_self); EXPECT_SYSER(proc, chown("/proc/self", 0, 0), -1, EPERM); break; CASE_TEST(chroot_root); EXPECT_SYSZR(euid0, chroot("/")); break; CASE_TEST(chroot_blah); EXPECT_SYSER(1, chroot("/proc/self/blah"), -1, ENOENT); break; - CASE_TEST(chroot_exe); EXPECT_SYSER(proc, chroot("/proc/self/exe"), -1, ENOTDIR); break; + CASE_TEST(chroot_exe); EXPECT_SYSER2(1, chroot(proc ? "/proc/self/exe" : "/init"), -1, ENOTDIR, ENOENT); break; CASE_TEST(close_m1); EXPECT_SYSER(1, close(-1), -1, EBADF); break; CASE_TEST(close_dup); EXPECT_SYSZR(1, close(dup(0))); break; CASE_TEST(dup_0); tmp = dup(0); EXPECT_SYSNE(1, tmp, -1); close(tmp); break;