[PATCH v2 1/2] Refactor sigcontextinfo.h
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Aug 19 20:30:00 GMT 2019
On 19/08/2019 08:34, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>>> Oh, right. Wouldn't raise.c have to be compiled in this way?
>>
>> It is not strictly necessary for the test, since it will hit the expected PC
>> just before the raise call. However on some ABIs, sparc for instance,
>> backtrace stops right before the raise call.
>
> Hmm. That's strange. Maybe that's because there's a trampoline that
> requires unwinding tables?
I am not sure, sparc has the sigaction trampoline implemented in sigaction
and it is not build with -fasynchronous-unwind-tables.
>
>>> (We should really build all of glibc with asynchronous unwind tables.)
>>
>> Does libgcc_s require asynchronous unwind tables to correctly unwind? Or does
>> it need just for PTHREAD_CANCEL_ASYNCHRONOUS, where the unwind happens in the
>> signal handler instead of the syscall entry?
>
> I think this is highly architecture-specific. There are architecture
> defaults if there are no unwind tables (some assume a frame pointer,
> some assume a leaf function without any stack adjustments). In general,
> I suspect that on many architectures, unwind tables are required for
> unwinding. Distributions really should build all system libraries with
> unwind tables for that reason, but not all of them do, unfortunately.
> (Building with -fexceptions also enables an equivalent of SafeSEH for
> thread cancellation handling. This is avoids potential exploits that
> target the cancellation cleanup routine, which is relevant even if
> pthread_cancel is never actually called.)
It is indeed architecture-specific from my work with BZ#12683, which
make some code 'unwindable' in some platforms and not in other with
same compiler flags.
To enable unwind table as default one thing that we might check is the
result extra runtime size required to map the EH segments.
More information about the Libc-alpha
mailing list