This is the mail archive of the cygwin@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]

BUG found in cygwin1.dll : cygwin_dll_init() crash


Hi,

this mail is for cygwin developers mailing list I suppose, but as I am not
subscribed to it, I have to send it here (cygwin@cygwin.com).
I hope that someone would read it and send it where it should.

I found out some postings in the cygwin mailing list about a bug (actually a
"crash") that appeared when someone tries to
load the cygwin1.dll using LoadLibrary() and then calls the
"cygwin_dll_init()" function.
Because I needed this functionnality too, the same happened to me.

I think that I know the reason for this, and I want to allert you about it,
so that you can fix it in the next release of cygwin dll.

As I understood, the most important part of "cygwin_dll_init" is that is
calls  "dll_crt0_1 ()"
>From it side the "dll_crt0_1()" calls "pinfo_init()" function, which calls
"environ_init()".
The "environ_init()" function call "posify()" for some enviroment variables
like "TEMP" or "TMP" and some
others. To the "posify" calls "getwinenv" which uses "cur_environ()"
function. The problems comes exactly
from this function. It tries to access two poitners "*main_environ" and
"__cygwin_environ". The problem is that
till the moment when these two are accessed they are never initialized. So
as you can imagine, the DLL just crashes.
I noticed that "*main_environ" is initialized in "_dll_crt0 ()" but this
funtion is never used during dynamic loading with LoadLibrary()
so the "*main_environ" points to a random location in the memory. Sadly
enough but I could not find out where the __cygwin_environ is
initialized at all.

Well, that is all from me. I hope that it would be easier for you now to fix
this bug.

Best Regards,
    Stanimir Peev


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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