netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Mike Cardwell <linux@lists.grepular.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: /proc/net/ symlink interacts badly with threads (Re: Procfs race condition bug)
Date: Mon, 7 Jul 2014 14:41:55 +0100	[thread overview]
Message-ID: <20140707144155.7bbcf246@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <20140704101311.GA7020@glue.grepular.com>

On Fri, 4 Jul 2014 11:13:11 +0100
Mike Cardwell <linux@lists.grepular.com> wrote:

> I originally posted this two years ago (*) but received no response. I
> just had a look and the problem still exists on the 3.14 kernel I am
> currently running.
> 
> I *think* I've uncovered a race condition bug in procfs. If I attempt to

I don't think you have found a race condition.

/proc/net/tcp is a symbolic link to /proc/self/net/tcp

Your thread does an open of /proc/net/tcp, which is a symlink
to /proc/self/net/tcp. If your thread id matches your process id then all
will be as you expect, if not then all will be pear shaped.

As far as I can see the code is doing precisely what it should do. It's
just that the use of the symlink when namespaces were added produces some
rather odd effects. 

It's certainly a bug. It used to work, it's sensible it should work.

Added netdev

Alan

           reply	other threads:[~2014-07-07 13:41 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20140704101311.GA7020@glue.grepular.com>]

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=20140707144155.7bbcf246@alan.etchedpixels.co.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@lists.grepular.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).