From patchwork Fri Jul 7 18:45:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 117272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3499091vqx; Fri, 7 Jul 2023 12:41:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlE77Sax56g1OpgJZ2pNVdqgEmKvUN8M8Zk9K8XPaktfj6wux9s338K65IFZwXJZfVWgRpsg X-Received: by 2002:a17:90b:897:b0:265:780e:5edc with SMTP id bj23-20020a17090b089700b00265780e5edcmr7673934pjb.10.1688758881186; Fri, 07 Jul 2023 12:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688758881; cv=none; d=google.com; s=arc-20160816; b=C/FEutqgX0dABq289v4xXaPLbIfzl/KErgtIYQTg0ChnlueMGE6vnzWxk8XuT9uMjT V5FnKkJJmONgOze+n0a6ssXnyvOY1pZTrCnnOF9Y4+3zLS0MmWRPaOhtgFL+MvvhrtPf SyWNTc8W0lBfTQ31nDRT7lsOpTrK3dusmIK5E4l6Jw0HmUc/pdjDO56wc+8kCmEgcBuv RMfVQojIQ13bWyhOE+ymMOCkoVE/fMfNDHMOR64u/s8mcxET9/32CBwUqCfZVcSuJq0L O+nHYrTgzUNSE512KSSmFskae9kkDs5ie4SX771WOtrMJYpMYGDWusBy9wHmCxovITQw rQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=dEWCL0ctjUxae5faaNIN6vRa36XHfRicZHVFprV8W1c=; fh=kgRNfNE6xRCHBUX3iUlrLhv5pQPglsdZFzOkxo2Fhpc=; b=AWbjPaRBKrtlyVzpttACpl3ZMLIhaoukPbcjULH0oXQCsajR6UV5E8/gEtkMpL6jeW QiRLOM8BOe/GsHFajy5Ap2TzDP4AEzdWzW2b6zShNDag8DJmADxAO19NNhnNKZPP6vHV wmMa9U2/M3FHJgXdNYRxMJijzANEZXNSu8huCpy3tfDWYrW6gVi3q/Uc3lsMOg+3jaqY t4+HKQZl0PXSCODIjlG2fVdsd8W8KtLhBY0XwpwL96UbC+ft4hgscm+hsIAXcVHseoeB xZEwU9i8UivA0unV1kliGZstEqnerR/2jVIuYpPkF2vnnfBszKfyTPBGvWxWyidCZb2p VsCQ== ARC-Authentication-Results: i=1; mx.google.com; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a17090ac28100b00262e28866d4si2774312pjt.163.2023.07.07.12.41.08; Fri, 07 Jul 2023 12:41:21 -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; 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 S232693AbjGGSp2 (ORCPT + 99 others); Fri, 7 Jul 2023 14:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjGGSp2 (ORCPT ); Fri, 7 Jul 2023 14:45:28 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CE522130; Fri, 7 Jul 2023 11:45:26 -0700 (PDT) X-QQ-mid: bizesmtp67t1688755517t6zf8zx8 Received: from linux-lab-host.localdomain ( [116.30.131.119]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 08 Jul 2023 02:45:16 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: Xz3VOcA7Mr23TD+MxBGuqCLuoaQVTw9wn1kX2MooEVE7xaVCf2Ulc9NFyLVp4 J2s7OzOFoftCwuXSVhAq4XJYt0Bue03Q18ZXrM8uvRsnudoZ58mWFkJz4yNFBkdOXL5xGMy CAdhWhwFThY9IuFQswZCjPkQsCMI5iCg0vm8IBYnrufY9/Sj5hImKJsCPCTfn+HK69z3W73 Vc70g/bvm+n06Lj6Qj0uWrJ6OgXUfrgXjF0YAfROflWkrTqyUmWc4SG0SDCW0ht3EFP6zx6 ldzx+YG5BRFT+wO2ILNcZQgD0Vyfm2FqutCTFvZPHk4E4pRKB/PaMlMCFT/aeN2VJbws/U1 g1iL+8qT8tm/WUsZEWokHzfTcNXtuijoW7U4DpiTgajggeXt2exFfunqENitR74BnUWMQRy X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5870997765808739935 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, thomas@t-8ch.de Subject: [PATCH v4 17/18] selftests/nolibc: chroot_exe: remove procfs dependency Date: Sat, 8 Jul 2023 02:45:08 +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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770792032503193137?= X-GMAIL-MSGID: =?utf-8?q?1770792032503193137?= Since argv0 also works for CONFIG_PROC_FS=n, let's use it instead of '/proc/self/exe'. 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 2065b5b0d171..c74b2af2414e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -710,7 +710,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_SYSER(1, chroot(argv0), -1, ENOTDIR); 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;