public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
Date: Tue, 17 Jan 2012 15:43:00 -0000	[thread overview]
Message-ID: <bug-49484-4-0hiY8Cym8c@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49484-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-17 15:39:19 UTC ---
strace showing that file-locking, even with using gettid doesn't work:

16980 gettid( <unfinished ...>
16981 gettid()                          = 16981
16981 open("/tmp/t.gcda", O_RDWR|O_CREAT, 0666) = 3
16981 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
16981 fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
16981 close(3)                          = 0
16980 <... gettid resumed> )            = 16980
16980 open("/tmp/t.gcda", O_RDWR|O_CREAT, 0666) = 3
16980 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
16980 fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
16982 gettid()                          = 16982
16982 open("/tmp/t.gcda", O_RDWR|O_CREAT, 0666) = 3
16982 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}
<unfinished ...>
16983 gettid()                          = 16983
16983 --- SIGABRT (Aborted) @ 0 (0) ---
16982 <... fcntl resumed> )             = 0
16979 +++ killed by SIGABRT (core dumped) +++
16982 fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
16982 close(3)                          = 0

it seems that the first close of fd 3 makes all further locks (even to
different l_pid) noops.  I suppose l_pid is simply ignored ofr F_SETLK[W]
and the current PID is used.  That makes the file-locking in libgcov
non-thread-safe.


  parent reply	other threads:[~2012-01-17 15:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21  9:05 [Bug gcov-profile/49484] New: " cobexer at gmail dot com
2011-06-21  9:24 ` [Bug gcov-profile/49484] " mikpe at it dot uu.se
2011-06-24  9:34 ` cobexer at gmail dot com
2011-10-07 12:13 ` vijay910 at gmail dot com
2012-01-17 14:28 ` rguenth at gcc dot gnu.org
2012-01-17 15:21 ` rguenth at gcc dot gnu.org
2012-01-17 15:26 ` rguenth at gcc dot gnu.org
2012-01-17 15:43 ` rguenth at gcc dot gnu.org [this message]
2012-01-18 10:57 ` rguenth at gcc dot gnu.org
2012-01-18 11:51 ` jakub at gcc dot gnu.org
2012-01-18 12:03 ` rguenth at gcc dot gnu.org
2012-01-18 13:30 ` rguenth at gcc dot gnu.org
2012-01-18 13:44 ` rguenth at gcc dot gnu.org
2012-01-18 13:48 ` jakub at gcc dot gnu.org
2012-01-18 17:14 ` rguenth at gcc dot gnu.org
2012-03-12 14:23 ` rguenth at gcc dot gnu.org
2012-03-12 14:26 ` rguenth at gcc dot gnu.org
2012-03-12 15:01 ` redi at gcc dot gnu.org
2012-03-12 15:07 ` redi at gcc dot gnu.org
2012-03-12 15:10 ` redi at gcc dot gnu.org
2012-03-12 15:29 ` rguenth at gcc dot gnu.org
2012-03-12 15:52 ` rguenth at gcc dot gnu.org
2012-03-12 15:55 ` redi at gcc dot gnu.org
2012-03-12 16:00 ` redi at gcc dot gnu.org
2012-03-12 16:03 ` rguenther at suse dot de
2012-05-01 21:23 ` asharif at gcc dot gnu.org
2012-05-02 22:52 ` asharif at gcc dot gnu.org
2012-12-06 20:10 ` asharif at gcc dot gnu.org
2012-12-07  2:36 ` asharif at gcc dot gnu.org

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=bug-49484-4-0hiY8Cym8c@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).