[PATCH 1/2] setjmp: Use BSD sematic as default for setjmp

Florian Weimer fweimer@redhat.com
Wed Aug 2 07:59:38 GMT 2023


* Adhemerval Zanella Netto:

> On 01/08/23 05:35, Florian Weimer wrote:
>> * Adhemerval Zanella via Libc-alpha:
>> 
>>> POSIX relaxed the relation of setjmp/longjmp and the signal mask
>>> save/restore, meaning that setjmp does not require to be routed to
>>> _setjmp to be standard compliant.
>>>
>>> This is done to avoid breakage of SIGABRT handlers, since to fully
>>> make abort AS-safe, it is required to remove the recurisve lock
>>> used to unblock SIGABRT prior raised the signal.
>>>
>>> Also, it allows caller to actually use setjmp, since from
>>> 7011c2622fe3e10a29dbe74f06aaebd07710127d the symbol is unconditionally
>>> routed to _setjmp.
>> 
>> Doesn't this have non-trivial performance impact?
>
> Yes, it is two extra sigprocmask to get/set the signal mask.  This is
> not *strictly* required, but the SIGABRT on abort generates racy
> conditions on process creation and.  This patch can be dropped, but it
> would mean that to get expected semantic for abort handlers will need
> to use sigsetjmp (..., 1) instead of setjmp.

Sorry, I don't understand?  With the current locking, this change should
really not be required because the user SIGABRT handler does not run
with the signal mask changed.

Thanks,
Florian



More information about the Libc-alpha mailing list