mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Davide Libenzi <davidel@xmailserver.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH 3/3] do_wait: fix waiting for stopped group with dead leader
Date: Mon, 10 Dec 2007 17:38:22 -0700	[thread overview]
Message-ID: <m1sl2a2hhd.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20071208183802.GA9946@tv-sign.ru> (Oleg Nesterov's message of "Sat, 8 Dec 2007 21:38:02 +0300")

Oleg Nesterov <oleg@tv-sign.ru> writes:

> do_wait(WSTOPPED) assumes that p->state must be == TASK_STOPPED, this is not
> true if the leader is already dead. Check SIGNAL_STOP_STOPPED instead and use
> ->signal->group_exit_code.
>
> This patch is not complete if not buggy. At the very minimum it needs cleanup.

Thinking about this set of problems.  Testing SIGNAL_STOP_STOPPED
seems more correct then testing TASK_STOPPED.  It ensures we don't
have a race, and except for ptrace the only way to stop a task
triggers SIGNAL_STOP_STOPPED.

We need a similar flag for thread group exit, to mark when every task
in the thread group has exited.

With those in place we can have race free tests of our status.
/proc/<tgid>/status needs to be updated to use those the per
signal struct status bits as well.

As for the exit_code, we set tsk->exit_code = sig->group_exit_code
so that doesn't seem to be a problem either.

So to get a task group status looking at bits on the signal struct
looks like the right approach, as this ensures we can avoid races in
setting the status, and we don't need to test a dozen other fields.

There is still some value in my other approach but even it will
have small races if we continue look at per task status bits when
what we want is a per thread group status.

Eric

      reply	other threads:[~2007-12-11  0:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-08 18:38 Oleg Nesterov
2007-12-11  0:38 ` Eric W. Biederman [this message]

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=m1sl2a2hhd.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /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®