segfault with pthread_cancel() and PTHREAD_STACK_MIN on armv7

Florian Weimer
Mon Feb 13 18:15:00 GMT 2017

On 02/13/2017 03:08 PM, Adhemerval Zanella wrote:
> GLIBC implements thread cancellation through a signal (SIGCANCEL/__SIGRTMIN),
> so when a thread is cancelled a glibc internal signal handler
> (sigcancel_handler) is executed.  Since glibc does not use an alternate
> stack for signal handling (sigaltstack), the thread own stack will be
> used to actually run the handle and subsequent stack trace.
> It will really depend of the stack usage when the signal arrives and also
> on compiler options and version, but in either way if you intend to handle
> signal (and cancellation will fall in this category) you will need to take
> in consideration the signal stack size on pthread stack size.

Note that the stack requirements also depend *a lot* on the kernel 
version and CPU features supported.  This is because the kernel pushes 
all the siginfo_t information on the application stack, and the CPU 
state grows larger and larger with every CPU generation.

So it might well be the case that 16 KiB was fine some time ago, but is 
insufficient today.


More information about the Libc-help mailing list