On Dec 22 23:37, Takashi Yano via Cygwin wrote:
> Alignment issue?
>
> This might be the right thing.
>
> diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
> index 86a00e76e..ec1e3c98c 100644
> --- a/winsup/cygwin/thread.cc
> +++ b/winsup/cygwin/thread.cc
> @@ -630,6 +630,8 @@ pthread::cancel ()
> threadlist_t *tl_entry = cygheap->find_tls (cygtls);
> if (!cygtls->inside_kernel (&context))
> {
> + if ((context._CX_stackPtr & 8) == 0)
> + context._CX_stackPtr -= 8;
Does that really help? Checking for 8 byte alignment is usually done
with (X & 7) != 0, because this won't catch 16 byte aligned stacks.
But afaic the stack is always 8 byte aligned anyway. However, there are
some scenarios where 16 byte alignment is required, as for context
itself when calling RtlCaptureContext. Maybe that's the problem here?
But the context Stackptr is the stackpointer of the current function the
target thread is running in. The instruction pointer is set to
pthread::static_cancel_self(), which doesn't get any arguments and doesn't
use any content from the stack.
It might be a good idea to make sure the stack is always 16 byte
aligned, but I don't see why pthread::static_cancel_self() ->
pthread::cancel_self() -> pthread::exit() would require other than 8
byte alignment.
Apparently something in pthread::exit() crashes? But where? Does
adding debug_printf's help to figure that out?
Corinna
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple