linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Reber <areber@redhat.com>
To: Andrei Vagin <avagin@gmail.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Pavel Emelyanov <ovzxemul@gmail.com>,
	Jann Horn <jannh@google.com>, Oleg Nesterov <oleg@redhat.com>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-kernel@vger.kernel.org, Mike Rapoport <rppt@linux.ibm.com>,
	Radostin Stoyanov <rstoyanov1@gmail.com>
Subject: Re: [PATCH v10 2/2] selftests: add tests for clone3() with *set_tid
Date: Fri, 15 Nov 2019 16:14:20 +0100	[thread overview]
Message-ID: <20191115151420.GC20767@dcbz.redhat.com> (raw)
In-Reply-To: <20191114183421.GA171963@gmail.com>

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


  reply	other threads:[~2019-11-15 15:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 14:27 [PATCH v10 1/2] fork: extend clone3() to support setting a PID Adrian Reber
2019-11-14 14:27 ` [PATCH v10 2/2] selftests: add tests for clone3() with *set_tid Adrian Reber
2019-11-14 14:49   ` Christian Brauner
2019-11-14 18:34   ` Andrei Vagin
2019-11-15 15:14     ` Adrian Reber [this message]
2019-11-15 18:39       ` Andrei Vagin
2019-11-14 19:05   ` Andrei Vagin
2019-11-14 15:50 ` [PATCH v10 1/2] fork: extend clone3() to support setting a PID Oleg Nesterov
2019-11-14 16:40 ` Christian Brauner
2019-11-14 19:15 ` Andrei Vagin
2019-11-15  9:34   ` Oleg Nesterov
2019-11-15  9:58     ` Christian Brauner
2019-11-15 10:49       ` Oleg Nesterov
2019-11-15 13:08         ` Christian Brauner
2019-11-16 22:55           ` Eric W. Biederman

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=20191115151420.GC20767@dcbz.redhat.com \
    --to=areber@redhat.com \
    --cc=0x7f454c46@gmail.com \
    --cc=avagin@gmail.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=ebiederm@xmission.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=oleg@redhat.com \
    --cc=ovzxemul@gmail.com \
    --cc=rppt@linux.ibm.com \
    --cc=rstoyanov1@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).