mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gavin Howard <gavin.d.howard@gmail.com>
To: musl@lists.openwall.com
Subject: Re: [musl] Possible PEBKAC or Bug in musl Semaphores and/or Mutexes
Date: Tue, 15 Mar 2022 14:35:51 -0600	[thread overview]
Message-ID: <CAF=dzRMJULoFOLW0+6p_SRLfXXOXpLAGVgvAfdZHUQUYXhbYUQ@mail.gmail.com> (raw)
In-Reply-To: <20220315195056.GA8457@voyager>

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

Well, I am a fool. I must have been too tired when I checked that.

Gavin Howard

On Tue, Mar 15, 2022, 13:51 Markus Wichmann <nullplan@gmx.net> wrote:

> 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
>

[-- Attachment #2: Type: text/html, Size: 1494 bytes --]

      reply	other threads:[~2022-03-15 20:36 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
2022-03-15 20:35                   ` Gavin Howard [this message]

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='CAF=dzRMJULoFOLW0+6p_SRLfXXOXpLAGVgvAfdZHUQUYXhbYUQ@mail.gmail.com' \
    --to=gavin.d.howard@gmail.com \
    --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).