public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* pthread_cancel async-signal-safe
@ 2020-12-04 18:19 Adhemerval Zanella
  2020-12-04 18:29 ` Florian Weimer
  2020-12-04 18:32 ` Joseph Myers
  0 siblings, 2 replies; 17+ messages in thread
From: Adhemerval Zanella @ 2020-12-04 18:19 UTC (permalink / raw)
  To: GNU C Library, Florian Weimer

POSIX states that pthread_cancel should be async-signal-safe [1].
IMU there are two main issues in current implementation that prevents
it:

  1. The pthread_cancel_init for shared builds,
  2. And the SIGCANCEL raise for asynchronous cancellation.

For 2. it would be possible to use a safer raise implementation and I 
have sent a patch where it fixes for pthread_kill [2].  It should be 
simple to use __pthread_kill_internal on pthread_cancel as well.

For 1. I don't see a easier solution without moving pthread_cancel_init
to out of pthread_cancel and this has its own drawbacks (by always
forcing loading libgcc_s.so when libpthread is linked).   

Florian, I recall that you had investigate some issue regarding C++
exceptions and signal handler that you presented on previous GNU 
Cauldron, so I wonder if you might have an idea how we can fix it.

Maybe linking libgcc_s.a statically with libpthread and remove the
dynamic loading of libgcc_s.so? I am not sure of this implication 
of this strategy.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
[2] https://sourceware.org/pipermail/libc-alpha/2020-December/120419.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-12-07 18:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 18:19 pthread_cancel async-signal-safe Adhemerval Zanella
2020-12-04 18:29 ` Florian Weimer
2020-12-04 18:37   ` Adhemerval Zanella
2020-12-04 18:43     ` Florian Weimer
2020-12-04 19:06       ` Adhemerval Zanella
2020-12-04 19:32         ` Florian Weimer
2020-12-04 19:39           ` Adhemerval Zanella
2020-12-04 18:32 ` Joseph Myers
2020-12-07 13:02   ` Adhemerval Zanella
2020-12-07 13:06     ` Florian Weimer
2020-12-07 13:30       ` Adhemerval Zanella
2020-12-07 13:33         ` Florian Weimer
2020-12-07 13:38           ` Adhemerval Zanella
2020-12-07 13:41             ` Florian Weimer
2020-12-07 13:54               ` Adhemerval Zanella
2020-12-07 15:52                 ` Florian Weimer
2020-12-07 18:08     ` Joseph Myers

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