mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: Zhangjin Wu <falcon@tinylab.org>
Cc: w@1wt.eu, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 13/15] selftests/nolibc: rename chroot_exe to chroot_tmpfile
Date: Fri, 30 Jun 2023 10:45:25 +0200	[thread overview]
Message-ID: <8665cddc-0ac8-497c-848e-aaa42398bf24@t-8ch.de> (raw)
In-Reply-To: <a38a6057866b597e5f931de550f2a6f24404ecdf.1688078605.git.falcon@tinylab.org>

On 2023-06-30 08:00:28+0800, Zhangjin Wu wrote:
> For CONFIG_PROC_FS=n, let's use tmpfs and create a tmp file for
> chroot_exe test.
> 
> Since chroot_exe is mainly testing the not directory case (ENOTDIR), so,
> rename it to chroot_tmpfile may be better.
> 
> Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> ---
>  tools/testing/selftests/nolibc/nolibc-test.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index 1002e0267515..2e9eaa7efa6e 100644
> --- a/tools/testing/selftests/nolibc/nolibc-test.c
> +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> @@ -682,6 +682,8 @@ int run_syscall(int min, int max)
>  	int ret = 0;
>  	void *p1, *p2;
>  	int has_gettid = 1;
> +	const char *tmpfile = get_tmpfile("/tmp/dummy");
> +	int has_tmpfile = tmpfile != NULL;
>  
>  	/* <proc> indicates whether or not /proc is mounted */
>  	proc = stat("/proc", &stat_buf) == 0;
> @@ -720,7 +722,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_tmpfile);    EXPECT_SYSER(has_tmpfile, chroot(tmpfile), -1, ENOTDIR); break;

get_tempfile() looks really weird.
Given that the nolibc implementation of chroot() is the most trivial
imaginable in my opinion we can keep the current "chroot_exe" that is
using procfs.

>  		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;
> -- 
> 2.25.1
> 

  reply	other threads:[~2023-06-30  8:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 23:22 [PATCH v2 00/15] allow run with minimal kernel config Zhangjin Wu
2023-06-29 23:23 ` [PATCH v2 01/15] selftests/nolibc: stat_fault: silence NULL argument warning with glibc Zhangjin Wu
2023-06-29 23:25 ` [PATCH v2 02/15] selftests/nolibc: gettid: restore for glibc and musl Zhangjin Wu
2023-06-29 23:26 ` [PATCH v2 03/15] selftests/nolibc: add _LARGEFILE64_SOURCE for musl Zhangjin Wu
2023-06-29 23:28 ` [PATCH v2 04/15] selftests/nolibc: fix up int_fast16/32_t test cases " Zhangjin Wu
2023-06-29 23:29 ` [PATCH v2 05/15] selftests/nolibc: fix up kernel parameters support Zhangjin Wu
2023-06-29 23:31 ` [PATCH v2 06/15] selftests/nolibc: stat_timestamps: remove procfs dependency Zhangjin Wu
2023-06-29 23:37 ` [PATCH v2 07/15] selftests/nolibc: link_cross: use /proc/self/cmdline Zhangjin Wu
2023-06-29 23:45 ` [PATCH v2 08/15] tools/nolibc: add rmdir() support Zhangjin Wu
2023-06-29 23:48 ` [PATCH v2 09/15] selftests/nolibc: add a new rmdir() test case Zhangjin Wu
2023-06-29 23:49 ` [PATCH v2 10/15] selftests/nolibc: fix up failures when CONFIG_PROC_FS=n Zhangjin Wu
2023-06-29 23:52 ` [PATCH v2 11/15] selftests/nolibc: prepare /tmp for tmpfs or ramfs Zhangjin Wu
2023-06-30  8:32   ` Thomas Weißschuh
2023-06-30 10:18     ` Zhangjin Wu
2023-06-29 23:54 ` [PATCH v2 12/15] selftests/nolibc: add common get_tmpfile() Zhangjin Wu
2023-06-30  0:00 ` [PATCH v2 13/15] selftests/nolibc: rename chroot_exe to chroot_tmpfile Zhangjin Wu
2023-06-30  8:45   ` Thomas Weißschuh [this message]
2023-06-30 11:14     ` Zhangjin Wu
2023-06-30  0:01 ` [PATCH v2 14/15] selftests/nolibc: add chmod_tmpfile test Zhangjin Wu
2023-06-30  0:03 ` [PATCH v2 15/15] selftests/nolibc: vfprintf: remove MEMFD_CREATE dependency Zhangjin Wu
2023-06-30  8:50 ` [PATCH v2 00/15] allow run with minimal kernel config Thomas Weißschuh
2023-06-30 12:04   ` Zhangjin Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8665cddc-0ac8-497c-848e-aaa42398bf24@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=arnd@arndb.de \
    --cc=falcon@tinylab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®