This is the mail archive of the cygwin-developers@cygwin.com 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: dll_list::detach() can stackdump


On Thu, Nov 07, 2002 at 12:18:31PM -0500, Jason Tishler wrote:
> The above seems to imply that a bad address is passed into
> cygwin_detach_dll() for one of the DLLs.  Unfortunately, I don't
> understand why.

The above is an incorrect hypothesis.  Using the attached patch, I was
able to determine that the problem is on the dll_list::alloc() side:

    $ strace -o dll-25-2.log dll *.dll
    $ fgrep VirtualAlloc: dll-25-2.log | cut -c 31-
    dll_list::alloc: JLT: VirtualAlloc: i = 3, n = 0x674E0000
    dll_list::alloc: JLT: VirtualAlloc: i = 5, n = 0xAD0000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xAF0000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0x67F70000
**> dll_list::alloc: JLT: VirtualAlloc: i = 8, n = 0xB40000 <**
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xB60000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xB80000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xBC0000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xBE0000
    dll_list::alloc: JLT: VirtualAlloc: i = 3, n = 0x674E0000
    dll_list::alloc: JLT: VirtualAlloc: i = 5, n = 0xAD0000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xAF0000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0x67F70000
**> dll_list::alloc: JLT: VirtualAlloc: i = 5, n = 0xB20000 <**
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xB60000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xB80000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xBC0000
    dll_list::alloc: JLT: VirtualAlloc: i = 4, n = 0xBE0000

The lines above marked by "**>" correspond to the Expat.dll.  The first
corresponds to the parent, the second to the child.  Note that the dll
structure is located in a different place in the child than in the
parent.  Hence, when dll_list::detach() is called in the child, a memory
access violation occurs.

It appears that a child can have a free region that the parent didn't
when dll_list::alloc() is called.  Is there a way to get the child to
skip these holes?

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Attachment: dll_init.cc.diff
Description: Text document

Attachment: dll-25-2.log
Description: Text document


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