This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Only construct ucontext for SA_SIGINFO signal handlers


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]