X-Spam-Check-By: sourceware.org Date: Thu, 30 Mar 2006 01:35:54 +0200 Message-Id: <469738104@web.de> MIME-Version: 1.0 From: Bernhard Loos To: cygwin AT cygwin DOT com Subject: Re: dlopen() bug (new testcase) Content-Type: text/plain; charset=iso-8859-15 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k2TNa1Q7021804 > -----Ursprüngliche Nachricht----- > Von: Christopher Faylor > Gesendet: Wed, 29 Mar 2006 18:15:34 -0500 >On Thu, Mar 30, 2006 at 01:10:56AM +0200, Bernhard Loos wrote: >>I looked at the problem again this week, but unfortunately I'm unable >>to debug anything happening after the first SIGSEGV. I inserted a view >>OutputDebugString()-calls and got those results: >> >>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. >> >>It looks, like Windows unloads the DLL after the first exception even before the myfault-exception handler is able to catch it. >>So return_from_fault() tries to longjmp to code wich isn't present any more an the second exception occurs. >> >>To fix this problem, I would suggest to use the IsBadReadPtr()-function instead of the myfault-exception handler to check the pointer in >>verifyable_object_isvalid(). >>I could write a patch, if nobody has any objections. > >Sorry, no. We *just* got rid of IsBadReadPtr's. Just out of interest, what's the problem with IsBadReadPtr? > >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. At the moment, cygwin is unable to load any C++-Dll with static classes calling the pthread_key_create in their constructor. As the standart C++ exception code also calls this function, this happens also, if a object is created in the constructor. Bernhard Loos PS: Please CC me, I'm not subscribed to the list. ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 -- 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/