mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Raphael S. Carvalho" <raphael.scarv@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] kernel/pid.c: Masking the flag out to get the actual value.
Date: Tue, 11 Jun 2013 15:45:18 -0700	[thread overview]
Message-ID: <20130611154518.fda9262961c21e96a57cbd5e@linux-foundation.org> (raw)
In-Reply-To: <1370901398-8989-1-git-send-email-raphael.scarv@gmail.com>

On Mon, 10 Jun 2013 18:56:38 -0300 "Raphael S. Carvalho" <raphael.scarv@gmail.com> wrote:

> This patch shouldn't be applied if those branches must only be taken when
> the pid_allocation(PIDNS_HASH_ADDING) flag was turned off.

Well yes - hopefully this is the case.  Otherwise we're missing some
rather important-looking wakeups.


> Otherwise, we must turn the PIDNS_HASH_ADDING flag (1U << 31) off
> before getting into the switch-cases.
> 
> ...
>
> --- a/kernel/pid.c
> +++ b/kernel/pid.c
> @@ -263,7 +263,10 @@ void free_pid(struct pid *pid)
>  		struct upid *upid = pid->numbers + i;
>  		struct pid_namespace *ns = upid->ns;
>  		hlist_del_rcu(&upid->pid_chain);
> -		switch(--ns->nr_hashed) {
> +
> +		/* We must turn the PIDNS_HASH_ADDING flag off to
> +		   get the actual value of nr_hashed */
> +		switch ((--ns->nr_hashed) & ~(PIDNS_HASH_ADDING)) {
>  		case 1:
>  			/* When all that is left in the pid namespace
>  			 * is the reaper wake up the reaper.  The reaper

Eric, can you please take a look?  Presumably and hopefully
PIDNS_HASH_ADDING cannot be set here, but what guarantees this?

Hopefully we can fix this one by adding the missing comment.

  reply	other threads:[~2013-06-11 22:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 21:56 Raphael S. Carvalho
2013-06-11 22:45 ` Andrew Morton [this message]
2013-06-12  1:16   ` Eric W. Biederman
2013-06-12  1:28     ` Andrew Morton
2013-06-12  1:53       ` 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=20130611154518.fda9262961c21e96a57cbd5e@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raphael.scarv@gmail.com \
    --cc=serge.hallyn@canonical.com \
    --cc=serge@hallyn.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

all inboxes | Powered by JetHome®