[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191115151420.GC20767@dcbz.redhat.com>
Date: Fri, 15 Nov 2019 16:14:20 +0100
From: Adrian Reber <areber@...hat.com>
To: Andrei Vagin <avagin@...il.com>
Cc: Christian Brauner <christian.brauner@...ntu.com>,
Eric Biederman <ebiederm@...ssion.com>,
Pavel Emelyanov <ovzxemul@...il.com>,
Jann Horn <jannh@...gle.com>, Oleg Nesterov <oleg@...hat.com>,
Dmitry Safonov <0x7f454c46@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-kernel@...r.kernel.org, Mike Rapoport <rppt@...ux.ibm.com>,
Radostin Stoyanov <rstoyanov1@...il.com>
Subject: Re: [PATCH v10 2/2] selftests: add tests for clone3() with *set_tid
On Thu, Nov 14, 2019 at 10:34:21AM -0800, Andrei Vagin wrote:
> > + /*
> > + * This should work and from the parent we should see
> > + * something like 'NSpid: pid 42 1'.
> > + */
> > + test_clone3_set_tid(set_tid, 3, CLONE_NEWPID, 0, 42, true);
> > +
> > + _exit(ksft_cnt.ksft_pass);
> > + }
> > +
> > + close(pipe_1[1]);
> > + close(pipe_2[0]);
> > + while (read(pipe_1[0], &buf, 1) > 0) {
>
> If a child process will crash, this will be a busyloop.
No. To be honest the whole loop is unnecessary. If the loop is entered
there is immediately a break.
> > + ksft_print_msg("[%d] Child is ready and waiting\n", getpid());
> > + break;
> > + }
If the loop is not entered it does not loop. So the whole thing is
useless. I think I was expecting it to block, but it doesn't work that
way.
> > + snprintf(proc_path, sizeof(proc_path), "/proc/%d/status", pid);
> > + f = fopen(proc_path, "r");
> > + if (f == NULL)
> > + ksft_exit_fail_msg(
> > + "%s - Could not open %s\n",
> > + strerror(errno), proc_path);
If the child does not exist anymore, the test will fail here and exit.
Besides this while() I tried to address all your comments in v11. Any
further comments on the test?
Adrian
Powered by blists - more mailing lists