public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kevin.dempsey at aculab dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug nptl/12674] sem_post/sem_wait race causing sem_post to return EINVAL
Date: Fri, 10 Feb 2012 16:26:00 -0000	[thread overview]
Message-ID: <bug-12674-131-ygGiHgOmrP@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12674-131@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=12674

Kevin Dempsey <kevin.dempsey at aculab dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kevin.dempsey at aculab dot
                   |                            |com

--- Comment #8 from Kevin Dempsey <kevin.dempsey at aculab dot com> 2012-02-10 16:26:32 UTC ---
We have been getting the same problem on an Amazon EC2 instance running a
Fedora 8 (2.6.21.7-5.fc8 kernel-xen) based image with glibc.i686 2.7-2, using
the nosegneg variant. The program aborts when sem_post() returns an error and
has been averaging one failure every three months.

Having seen this bug report, I have been testing with a program based on the
original reporters source. On an EC2 instance I have not had it run for more
than 4 hours before failing (I have not seen a failure on bare metal). When a
failure does occur the strace output shows the futex() syscall has been made
with an invalid operation:
12072 futex(0x9152098, 0x1010101 /* FUTEX_??? */, 1) = -1 ENOSYS (Function not
implemented)
presumably because the PRIVATE field has been overwritten.

>From the glibc source repository it appears that this race was introduced when
the change was made to make sem_post() only call FUTEX_WAKE when there are
threads waiting. In fact, with the test program forced to use the old
implementation (using .symver) I haven't had it fail.

If the value and nwaiters were next to each other then they could both be
accessed atomically using cmpxchg8b (on i586 and later). Perhaps then somebody
skilled in the art could eliminate the race condition?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2012-02-10 16:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14  6:33 [Bug nptl/12674] New: " dhatch at ilm dot com
2011-04-14  6:34 ` [Bug nptl/12674] " dhatch at ilm dot com
2011-04-14  8:15 ` albertito at blitiri dot com.ar
2011-04-15  8:31 ` vapier at gentoo dot org
2011-04-15 14:57 ` ppluzhnikov at google dot com
2011-04-17  3:50 ` drepper.fsp at gmail dot com
2011-04-18 19:26 ` dhatch at ilm dot com
2011-04-19  0:04 ` dhatch at ilm dot com
2011-04-19 11:26 ` drepper.fsp at gmail dot com
2011-04-19 22:07 ` dhatch at ilm dot com
2011-08-04  4:49 ` lopresti at gmail dot com
2011-08-07 18:10 ` bugdal at aerifal dot cx
2012-02-10 16:26 ` kevin.dempsey at aculab dot com [this message]
2012-02-10 16:29 ` kevin.dempsey at aculab dot com
2012-02-16 15:31 ` carlos at systemhalted dot org
2012-09-25 21:20 ` raj at mischievous dot us
2013-01-12  0:40 ` piotr.stanczyk at gmail dot com
2013-01-12  0:48 ` raj at mischievous dot us
2013-01-24 16:51 ` piotr.stanczyk at gmail dot com
2013-09-13 20:21 ` michael.ballantyne at gmail dot com
2013-09-13 20:27 ` carlos at redhat dot com
2013-09-14 16:47 ` bugdal at aerifal dot cx
2013-11-04 13:29 ` ismail at donmez dot ws
2013-11-06 16:44 ` ljanyst at cern dot ch
2013-12-20 17:50 ` triegel at redhat dot com
2014-02-16 18:29 ` jackie.rosen at hushmail dot com
2014-05-28 19:44 ` schwab at sourceware dot org
2014-06-20 12:24 ` kevin.dempsey at aculab dot com
2014-06-20 18:30 ` triegel at redhat dot com
2014-06-27 13:36 ` fweimer at redhat dot com
2015-01-19 16:36 ` mtk.manpages at gmail dot com
2015-01-21  5:57 ` cvs-commit at gcc dot gnu.org
2015-01-21  5:59 ` carlos at redhat dot 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=bug-12674-131-ygGiHgOmrP@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).