From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [musl] Possible PEBKAC or Bug in musl Semaphores and/or Mutexes
Date: Tue, 15 Mar 2022 20:50:56 +0100 [thread overview]
Message-ID: <20220315195056.GA8457@voyager> (raw)
In-Reply-To: <CAF=dzRM40DYQJOv3oyROiJR+fjWKtn3q=fAfyTNLGEw0-cyMiA@mail.gmail.com>
On Tue, Mar 15, 2022 at 12:55:38PM -0600, Gavin Howard wrote:
> I am pretty sure that this is the right place and that it is a bug in
> musl.
Once more we find someone blaming the implementation for their own
mistake. From your repository:
| y_Status
| y_strucon_rwlock_wrlock(y_strucon_rwlock* l)
| {
| y_ThreadData d = y_strucon_thread_os_get();
|
| yc_assert(l != NULL, YC_ASSERT_NULL);
| yc_assert(d != NULL, YC_ASSERT_NULL);
|
| y_THREAD_TRYLOCK1(d);
|
| y_Status s = y_strucon_rwlock_os_rdlock(l);
|
| return s;
| }
The mistake is in this function. See what the function is called and
what subfunction it calls? No wonder multiple threads can take the lock
simultaneously.
Also, while reading I found a glaring mistake in y_THREAD_TRYUNLOCK1(),
which I shall leave as homework to the reader.
Ciao,
Markus
next prev parent reply other threads:[~2022-03-15 19:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 19:41 Gavin Howard
2022-03-11 20:21 ` Rich Felker
2022-03-12 5:45 ` Gavin Howard
2022-03-12 15:01 ` Rich Felker
2022-03-12 17:10 ` Gavin Howard
2022-03-14 16:09 ` enh
2022-03-14 16:12 ` Gavin Howard
2022-03-14 16:23 ` Rich Felker
2022-03-15 18:55 ` Gavin Howard
2022-03-15 19:50 ` Markus Wichmann [this message]
2022-03-15 20:35 ` Gavin Howard
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=20220315195056.GA8457@voyager \
--to=nullplan@gmx.net \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).