This is the mail archive of the cygwin 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: CVS 1.7.0 heap errors

On Jul 18 12:04, Corinna Vinschen wrote:
> On Jul 17 14:54, Brian Ford wrote:
> > > > On Wed, 27 Jun 2007, Corinna Vinschen wrote:
> > > You could also try to eliminate any change from
> > > which is not
> > > related to your problem, [...]
> > 
> > You don't have any suggestions for how to best separate the patch into
> > pieces do you?
> Look into the ChangeLog for the patch.  It can be divided into two
> different changes:
> - Changing the cygheap->shared_prefix handling.
>   [...]
> - Changing the way the user privileges are set at process startup.
>   Affects, and security.h.
>   Stupidly glaring at this change, I'm wondering if this is the culprit.
>   The change itself looks quite harmless.  But the non-obvious result
>   is that already very early in the process initialization functions from
>   advapi32 are called.  OTOH, Cygwin is load-time linked against advapi32.
>   So that shouldn't have any negative effect.  Hmm.

I found an actual bug in this patch.  I moved the call to
set_cygwin_privileges (hProcToken); at process initialization to a point
at which hProcToken wasn't even initialized.

  *hitting myself with a big stick*

Weird that it worked at all.

This *might* be the cause of the failing heap_init.  The problem is that
the calls to AdjustTokenPrivileges in set_privilege fail and
debug_printf is called (too?) early in process initialization, which in
turn results in dynamically loading user32.dll or some other Windows
DLL.  If this happens before the heap is initialized, there's a chance
that the Windows DLL reserves space which is needed for the heap.

What you could do to verify this:  Apply the patch from
to Cygwin from right after the patch from
and try if the heap problem still occurs.


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

Unsubscribe info:
Problem reports:

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