This is the mail archive of the cygwin-developers 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: Statically initialising pthread attributes in dynamic dlls.


On Feb 22 11:27, Christopher Faylor wrote:
> On Mon, Feb 22, 2010 at 01:01:38PM +0100, Corinna Vinschen wrote:
> >Beep!  Wrong answer.  Actually the exception handler is called and
> >me.return_from_fault() is called as well.  But for some reason, which
> >is beyond me, it doesn't return from return_from_fault().  Instead,
> >it steps into the OS and gets terminated.  So there *is* something
> >not quite ok with the fault handling in this case.
> >
> >Btw., I can avoid all the weird effects by changing one single line:
> >
> >Index: thread.cc
> >===================================================================
> >RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
> >retrieving revision 1.220
> >diff -u -p -r1.220 thread.cc
> >--- thread.cc	12 Feb 2010 20:07:13 -0000	1.220
> >+++ thread.cc	22 Feb 2010 12:00:37 -0000
> >@@ -110,7 +110,7 @@ verifyable_object_isvalid (void const *o
> >       (static_ptr2 && *object == static_ptr2) ||
> >       (static_ptr3 && *object == static_ptr3))
> >     return VALID_STATIC_OBJECT;
> >-  if ((*object)->magic != magic)
> >+  if (!*object || (*object)->magic != magic)
> >     return INVALID_OBJECT;
> >   return VALID_OBJECT;
> > }
> >
> >Unfortunately it wouldn't help if the object is mallocated so that
> >*object is some random value.
> 
> I'll look into it.  I have threads somewhat pulled apart at this point
> (heh) so any changes you make will likely conflict with my sandbox.

No worries.  I didn't plan to apply this patch.

> It wouldn't be a terrible thing to check this for NULL early in the
> function since it's a cheap test but we do have to figure out why the
> efault handler isn't properly triggering since that would be
> catastrophic.

I agree.  Adding the test at this point just covers the other problem.

> Have you tried regenerating tlsoffsets.h, just in case?

That didn't occur to me, sorry.

[time passes]

Doesn't help.  tlsoffset.h was already up-to-date apparently and the
test still crashes.

Btw., of course I built mutex.dll with -shared :)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


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