|
|
Message-ID: <20230211171338.GD1903@voyager>
Date: Sat, 11 Feb 2023 18:13:38 +0100
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Cc: Alexey Izbyshev <izbyshev@...ras.ru>
Subject: Re: [PATCH] mq_notify: fix close/recv race on failure path
On Sat, Feb 11, 2023 at 10:06:03AM -0500, Rich Felker wrote:
> --- a/src/thread/pthread_detach.c
> +++ b/src/thread/pthread_detach.c
> @@ -5,8 +5,12 @@ static int __pthread_detach(pthread_t t)
> {
> /* If the cas fails, detach state is either already-detached
> * or exiting/exited, and pthread_join will trap or cleanup. */
> - if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE)
> + if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE) {
> + int cs;
> + __pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
> return __pthread_join(t, 0);
^^^^^^ I think you forgot to rework this.
> + __pthread_setcancelstate(cs, 0);
> + }
> return 0;
> }
>
I see no other obvious missteps, though.
Ciao,
Markus
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.