From: Mike Cardwell <linux@lists.grepular.com>
To: linux-kernel@vger.kernel.org
Subject: Procfs race condition bug
Date: Fri, 4 Jul 2014 11:13:11 +0100 [thread overview]
Message-ID: <20140704101311.GA7020@glue.grepular.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]
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
open a file in /proc/net, eg "/proc/net/tcp" it works fine, but if I
spawn a POSIX thread and attempt to do it from there, it *usually* fails
with a "No such file or directory", but some times succeeds. If I do a
system call inside the thread to look up the thread ID and then open
"/proc/THREADID/net/tcp" instead, it works fine.
There are more details and some example code so you can replicate the
problem on a stack overflow question I asked previously here:
http://stackoverflow.com/questions/11580020/opening-proc-net-tcp-in-c-from-a-posix-thread-fails-most-of-the-time
(*) https://lkml.org/lkml/2012/7/20/331
--
Mike Cardwell https://grepular.com https://emailprivacytester.com
OpenPGP Key 35BC AF1D 3AA2 1F84 3DC3 B0CF 70A5 F512 0018 461F
XMPP OTR Key 8924 B06A 7917 AAF3 DBB1 BF1B 295C 3C78 3EF1 46B4
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 598 bytes --]
next reply other threads:[~2014-07-04 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 10:13 Mike Cardwell [this message]
2014-07-07 13:41 ` /proc/net/ symlink interacts badly with threads (Re: Procfs race condition bug) One Thousand Gnomes
-- strict thread matches above, loose matches on Subject: below --
2014-07-09 12:17 Procfs race condition bug Alexey Dobriyan
2014-07-09 12:20 ` Alexey Dobriyan
2014-07-10 4:40 ` Eric W. Biederman
2012-07-20 18:12 Mike Cardwell
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=20140704101311.GA7020@glue.grepular.com \
--to=linux@lists.grepular.com \
--cc=linux-kernel@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).