From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 01/10] nptl: Perform signal initialization upon pthread_create
Date: Fri, 21 May 2021 08:31:46 -0300 [thread overview]
Message-ID: <b960924c-e024-958c-a402-8e10e8925e63@linaro.org> (raw)
In-Reply-To: <87tumwcsrx.fsf@oldenburg.str.redhat.com>
On 21/05/2021 06:58, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>>>> Bu the main advantage is to move the cancellation code logically when
>>>> it is actually used, and it is small improvement on both static
>>>> linking (since the static code will be used solely is cancellation is
>>>> used) and on runtime (since sigaction will be set only if pthread_cancel
>>>> is called).
>>>
>>> Okay, I can prepare a version along these lines. But in general, I
>>> consider less data and fewer conditionals an improvement.
>>
>> Thanks.
>
> Unfortunately, it does not work with the present implementation.
>
> sysdeps/unix/sysv/linux/createthread.c contains this:
>
> /* The operation failed. We have to kill the thread.
> We let the normal cancellation mechanism do the work. */
>
> pid_t pid = __getpid ();
> INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid, SIGCANCEL);
>
> This obviously needs a working SIGCANCEL handler, so pthread_create and
> pthread_cancel are not as separate as we thought.
We can use __libc_signal_block_app on pthread_create instead of
__libc_signal_block_all and call __pthread_cancel on createthread. The
SIGCANCEL is internal, so the race condition should not happen (assuming
well behave programs). The pthread_cancel call on createthread can then
enable the signal.
>
> So I think we should go with my original version for the time being. We
> can switch to lazy initialization if we implement a different way for
> handling late thread creation failure.
Alright, I think we can change it later.
>
> SIG_IGN handler disposition should not affect timer_create (which uses
> SIGCANCEL internally) because sigwaitinfo still wakes up on such
> signals.
>
> Thanks,
> Florian
>
next prev parent reply other threads:[~2021-05-21 11:31 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 14:24 [PATCH 00/10] nptl: Complete libpthread removal Florian Weimer
2021-05-18 14:24 ` [PATCH 01/10] nptl: Perform signal initialization upon pthread_create Florian Weimer
2021-05-20 19:15 ` Adhemerval Zanella
2021-05-20 19:41 ` Florian Weimer
2021-05-20 19:57 ` Adhemerval Zanella
2021-05-20 20:05 ` Florian Weimer
2021-05-20 20:32 ` Adhemerval Zanella
2021-05-21 9:58 ` Florian Weimer
2021-05-21 11:31 ` Adhemerval Zanella [this message]
2021-05-21 12:40 ` Adhemerval Zanella
2021-05-18 14:24 ` [PATCH 02/10] nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables Florian Weimer
2021-05-18 14:25 ` [PATCH 03/10] nptl: Move semi-public __pthread_get_minstack symbol into libc Florian Weimer
2021-05-18 14:25 ` [PATCH 04/10] elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2 Florian Weimer
2021-05-20 20:36 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 05/10] nptl: Move pthread_create, thrd_create into libc Florian Weimer
2021-05-20 20:44 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 06/10] nptl: Remove unused __libc_pthread_init function Florian Weimer
2021-05-18 14:49 ` Andreas Schwab
2021-05-18 14:25 ` [PATCH 07/10] nptl: Remove remaining code from libpthread Florian Weimer
2021-05-20 20:49 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 08/10] elf: Do not load libpthread for PTHREAD_IN_LIBC Florian Weimer
2021-05-20 20:53 ` Adhemerval Zanella
2021-05-21 19:15 ` Florian Weimer
2021-05-18 14:25 ` [PATCH 09/10] elf: Add facility to create stub DSOs in elf/stub-dsos Florian Weimer
2021-05-24 18:24 ` Adhemerval Zanella
2021-05-24 18:25 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 10/10] nptl: Stop building libpthread Florian Weimer
2021-05-18 14:56 ` [PATCH 00/10] nptl: Complete libpthread removal Andreas Schwab
2021-05-18 15:04 ` Florian Weimer
2021-05-18 15:26 ` Andreas Schwab
2021-05-18 15:51 ` Florian Weimer
2021-05-18 16:27 ` Andreas Schwab
2021-05-18 16:31 ` Florian Weimer
2021-05-18 16:47 ` Andreas Schwab
2021-05-20 13:27 ` Florian Weimer
2021-05-20 13:50 ` Andreas Schwab
2021-05-20 13:54 ` Florian Weimer
2021-05-20 14:01 ` Andreas Schwab
2021-05-20 15:09 ` H.J. Lu
2021-05-20 15:13 ` Florian Weimer
2021-05-20 15:17 ` Andreas Schwab
2021-05-20 15:35 ` H.J. Lu
2021-05-20 15:39 ` Florian Weimer
2021-05-20 15:57 ` H.J. Lu
2021-05-19 11:57 ` Szabolcs Nagy
2021-05-19 12:35 ` Florian Weimer
2021-05-19 13:14 ` Szabolcs Nagy
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=b960924c-e024-958c-a402-8e10e8925e63@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/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.
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).