bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __pthread_setcancelstate called unconditionally, crashes at 0


From: Florian Weimer
Subject: Re: __pthread_setcancelstate called unconditionally, crashes at 0
Date: Thu, 11 May 2023 20:12:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

* Sergey Bugaev:

>> If you need async cancellation support, the core cancellation routine
>> could be made weak, so that it is linked into the executable only if
>> pthread_cancel is ever called.
>
> Could you please expand on how this all (unwinding, async
> cancellation) is relevant? Clearly calling error () in a
> PTHREAD_CANCEL_ASYNCHRONOUS context is undefined behavior since error
> () is not async-cancel-safe.

I'd expect __pthread_setcancelstate to act on asynchronous cancellation
if it is enabled.  Once you implement that and have a strong symbol
reference to __pthread_setcancelstate, you'd pull in the cancellation
unwinder without additional measures, and this would into every program.
You probably don't want that.  So the reference to the core cancellation
had better be weak (or use the __libc_ptf_call indirection).

Does this answer your question?  Sorry, these static linking size
optimizations are tricky.

Thanks,
Florian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]