X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 24 Feb 2012 21:53:31 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: ldd fails when dll has no execute permissions Message-ID: <20120224205331.GG19218@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1330038220 DOT 54804 DOT YahooMailNeo AT web36708 DOT mail DOT mud DOT yahoo DOT com> <20120224204233 DOT GC19740 AT ednor DOT casa DOT cgf DOT cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120224204233.GC19740@ednor.casa.cgf.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Feb 24 15:42, Christopher Faylor wrote: > On Thu, Feb 23, 2012 at 03:03:40PM -0800, cppjavaperl wrote: > >This was discovered in cygwin-1.7.10-1. > > > >If you run 'ldd' against an executable, and the executable has > >dependent DLLs which do *not* have execute permissions, ldd's output > >stops when it reaches the offending dependent DLL, and reports no > >further information.? ldd does not give an error message, and the exit > >code is zero. > > > >To test, pick an application with a dependent DLL, then chmod 666 on > >that DLL (pick a DLL you can live without temporarily, of course), then > >run 'ldd' against the executable. > > Can't reproduce this (with the latest DLL from the snapshot): > > bash$ chmod a-w /bin/*.dll Try chmod -x instead of -w. And do that only to a single DLL or be prepared to suffer. > bash$ ldd /bin/pwd > ntdll.dll => /cygdrive/c/Windows/SysWOW64/ntdll.dll (0x779a0000) > kernel32.dll => /cygdrive/c/Windows/syswow64/kernel32.dll (0x75310000) > KERNELBASE.dll => /cygdrive/c/Windows/syswow64/KERNELBASE.dll (0x75ae0000) > cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000) > cygintl-8.dll => /usr/bin/cygintl-8.dll (0x61730000) > cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x63c10000) > > Given how ldd works, it's hard to see why executable permissions should > affect it. ldd starts the executable for debugging and tracks .dlls as > they are loaded. The executable bit state should have no effect on > that. It has. Windows only loads DLLs into executables if the execute bit is set. Here's what I did for testing: From tcsh, because I removed the execute bit from one of the DLLs used by bash: tcsh> ldd /bin/bash ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x77a30000) kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x75ec0000) KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x75cd0000) cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000) cygintl-8.dll => /usr/bin/cygintl-8.dll (0x68580000) cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x69460000) cygreadline7.dll => /usr/bin/cygreadline7.dll (0x67550000) cyggcc_s-1.dll => /usr/bin/cyggcc_s-1.dll (0x6bb40000) cygncursesw-10.dll => /usr/bin/cygncursesw-10.dll (0x66920000) USER32.dll => /cygdrive/c/Windows/system32/USER32.dll (0x776d0000) GDI32.dll => /cygdrive/c/Windows/system32/GDI32.dll (0x75fc0000) LPK.dll => /cygdrive/c/Windows/system32/LPK.dll (0x773c0000) USP10.dll => /cygdrive/c/Windows/system32/USP10.dll (0x777a0000) msvcrt.dll => /cygdrive/c/Windows/system32/msvcrt.dll (0x775c0000) IMM32.DLL => /cygdrive/c/Windows/system32/IMM32.DLL (0x77670000) MSCTF.dll => /cygdrive/c/Windows/system32/MSCTF.dll (0x77840000) tcsh> chmod -x /bin/cygreadline7.dll tcsh> ldd /bin/bash ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x77a30000) kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x75ec0000) KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x75cd0000) cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000) cygintl-8.dll => /usr/bin/cygintl-8.dll (0x68580000) cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x69460000) Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple