delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/30/08:44:45

X-Spam-Check-By: sourceware.org
Date: Thu, 30 Mar 2006 15:44:33 +0200
Message-Id: <470824954@web.de>
MIME-Version: 1.0
From: Bernhard Loos <bernloos AT web DOT de>
To: cygwin AT cygwin DOT com
Subject: Re: dlopen() bug (new testcase)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k2UDihgG007615

> -----Ursprüngliche Nachricht-----
> Von: Christopher Faylor
> Gesendet: Wed, 29 Mar 2006 19:06:56 -0500 


>>>00:00:00.703: LoadLibraryA("H:\cygwin\test\CrashTest\CrashTest.dll") called from "CYGWIN1.DLL" at address 0x6100FE42 by thread 1.
>>>00:00:00.718: Loaded "CRASHTEST.DLL" at address 0x003F0000 by thread 1.  Successfully hooked module.
>>>00:00:00.718: DllMain(0x003F0000, DLL_PROCESS_ATTACH, 0x00000000) in "CRASHTEST.DLL" called by thread 1.
>>>00:00:00.718: myfault::faulted
>>>00:00:00.718: setup_fault
>>>00:00:00.718: First chance exception 0xC0000005 (Access Violation) occurred in "CYGWIN1.DLL" at address 0x610B2DE2 by thread 1.
>>>00:00:00.718: Unloaded "CRASHTEST.DLL" at address 0x003F0000 by thread 1.
>>>00:00:00.718: LoadLibraryA("H:\cygwin\test\CrashTest\CrashTest.dll") returned NULL by thread 1. Error: Unzulssiger Zugriff auf einen Speicherbereich (998).
>>>00:00:00.781: First chance exception 0xC0000005 (Access Violation) occurred at address 0x003F101A by thread 1.
>>>00:00:00.781: return_from_fault
>>>00:00:00.781: First chance exception 0xC0000005 (Access Violation) occurred at address 0x40000060 by thread 1.
>>>00:00:00.781: First chance exception 0xC0000029 (Unknown) occurred in "NTDLL.DLL" at address 0x7C95EB28 by thread 1.


>>Just out of interest, what's the problem with IsBadReadPtr?

>You'll have to read the archives.  Eric Blake has talked about this very
>recently.

Sorry, but I'm unable to locate it. The last post mentioning IsBad*Ptr occoured
arround March 2005 -  not very recently.

>>>FWIW, I doubt that Windows is really ignoring an exception handler.
>>
>>The exception handler is called, but at least the return_from_fault is
>>called after the DLL gets unloaded, as you can see above.

>I don't see that in your output.  However, If that was the case, you
>should be able to set a breakpoint in the exception handler to verify
>it without resorting to contortions like adding OutputDebugString.

CRASHTEST.DLL is unloaded at timecode 00.718 and LoadLibary returns.
_cygtls::return_from_fault is called at 00.781 from the cygwin exception handler.
It restores the old handler befor it returns and but at this point, crashtest.dll
isn't loaded any more.

Inserting the line
 _my_tls.init_exception_handler (_cygtls::handle_exceptions);
in the dll:init() function solves this problem, but i'm not sure whether
this breaks other important things.

         Bernhard Loos

This is caused by the LoadLibary function creating its own exception handler wich overrides the cygwin handler. 
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


--
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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019