public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <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: Sun, 07 Aug 2011 18:10:00 -0000 [thread overview] Message-ID: <bug-12674-131-c7HFvg2Y5W@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-12674-131@http.sourceware.org/bugzilla/> http://sourceware.org/bugzilla/show_bug.cgi?id=12674 Rich Felker <bugdal at aerifal dot cx> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |bugdal at aerifal dot cx Resolution|INVALID | --- Comment #7 from Rich Felker <bugdal at aerifal dot cx> 2011-08-07 18:08:55 UTC --- After reading this bug report and followup comments, I have identified and fixed the corresponding bug in musl's implementation of POSIX semaphores. The fix is very easy and the same approach could easily be used to fix glibc/NPTL. There is not yet a release with the fix, but you can see the commit/diff in our git repository at: http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=commitdiff;h=88c4e720317845a8e01aee03f142ba82674cd23d;hp=88798393cab009ce78fe498051072db71ba9d035 The basic idea is that a waiter stores a flag that it's waiting in the atomic semaphore value field, in addition to incrementing the waiter count. This way sem_post can see "old" waiters by examining the waiters count *before* atomically upping the semaphore value, and can see a "last minute" waiter in the old semaphore value when it atomically replaces it with compare-and-swap. The same approach works for fixing the corresponding bug in mutexes and rwlocks. Note that a similar bug also exists for barriers, and I have a clean solution for non-process-shared barriers, but no solution for process-shared barriers that's not subject to failure cases. -- 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.
next prev parent reply other threads:[~2011-08-07 18:10 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 [this message] 2012-02-10 16:26 ` kevin.dempsey at aculab dot com 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-c7HFvg2Y5W@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: linkBe 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).