"Segmentation fault" CygWin tools with code Injection-MS Detours

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Thu Aug 11 16:33:00 GMT 2005


On Thu, Aug 11, 2005 at 06:01:08PM +0200, Louis Lecaroz wrote:
>I tried to LD_PRELOAD my Microsoft DLL Hook, & it appears to work, 
>cygwin is loaded correctly, & code is not injected but loaded by cygwin. &
>Hooks appears working ! that's a great improvement on my issue. So it 
>appears to be the code injection from one process to another one which 
>is doing crashing cygwin tools !
>
>But..... The LD_PRELOAD is only done one time when loading the first 
>instance of bash !

WOW!

>if starting another instance of a cygwin tool under bash, I can see in 
>my traces a createprocess on bash itself before loading the child process.
>I suppose bash forking itself before spawning the child process (ls.exe 
>for exemple). & because the forked process is initiliazed by a 
>setjmp/longjmp, the LD_PRELOAD not read in the forked instance (due to 
>entry point moved by the fork() methode of cygwin)...
>
>Am I wrong or right ?

I can't really tell from your description.  It looks like the LD_PRELOAD
stuff won't be called in the forkee, but I don't know if that's what you're
seeing or not.  It still works when a process is execed, so it seems
like it should be working most of the time.  I've fixed this in CVS.

I'll generate a snapshot with this change today.

>If yes, & if it is possible to correct this special really interresting 
>undocumented CygWin Feature, I think, it will allow me to trace systems 
>Win32 native call (not cygwin call like strace), in all cygwin tools. 

Sorry, but no, this is a cygwin-only solution.  It doesn't work with
non-cygwin DLLs.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list