Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 15 Mar 2022 14:35:51 -0600
From: Gavin Howard <gavin.d.howard@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Possible PEBKAC or Bug in musl Semaphores and/or Mutexes

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

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.