[PATCH] Only construct ucontext for SA_SIGINFO signal handlers

Jon TURNEY jon.turney@dronecode.org.uk
Fri Apr 3 12:51:00 GMT 2015


On 03/04/2015 13:17, Corinna Vinschen wrote:
> On Apr  3 13:18, Corinna Vinschen wrote:
>> On Apr  2 20:30, Jon TURNEY wrote:
>>
>>>         sigset_t this_oldmask = set_process_mask_delta ();
>>> -      thiscontext.uc_sigmask = this_oldmask;
>>> +      context.uc_sigmask = this_oldmask;
>>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> This call to set_process_mask_delta() should occur before constructing
>> the context, so that filling in uc_sigmask can be moved into the above
>> `'if' branch.

Ok, I will move it.

>> On second thought, isn't this slightly wrong anyway?  Shouldn't that be
>>
>>           context.uc_sigmask = _my_tls.sigmask;
>> 	 context.uc_mcontext.oldmask = this_oldmask;

As I wrote elsewhere:  You'll have to help me understand what the 
difference in meaning between ucontext_t.uc_sigmask and 
ucontext_t.uc_mcontext.oldmask is.

I don't see how the value of _my_tls.sigmask has any meaning at that 
point in the code.

> Oh, btw., what about cr2?  Right now, with the above code, it contains
> a random value.  It should at least be zero'ed out.  Alternatively:
>
>    context.uc_mcontext.cr2 = (thissi.si_signo == SIGSEGV
> 			     || thissi.si_signo == SIGBUS)
> 			    ? (uintptr_t) thissi.si_addr : 0;
>

Sure, but can we deal with that as a separate patch?



More information about the Cygwin-patches mailing list