3 ms·
Coincidentally, `ldd` has the same caveat on Cygwin, although there it's implemented as an executable instead of a shell script: ldd invokes the Windows lo
by omoikane 2y ago
Coincidentally, `ldd` has the same caveat on Cygwin, although there it's implemented as an executable instead of a shell script:
ldd invokes the Windows loader on the file specified, then uses the Windows debugging interface to report DLLs loaded, and (for executables) to attempt to stop execution before the entrypoint. Thus, you should never use ldd on an untrusted file.
https://cygwin.com/cygwin-ug-net/ldd.html https://cygwin.com/cygwin-ug-net/ldd.html
- userbinator 2y agoI wonder why they implemented it that way, since dynamic linking on Windows is much less of a mess than on *nix systems. dumpbin /imports and Depends have been the standard there for a long time.
- omoikane 2y agoMaybe it's to get the addresses where the DLLs would be loaded? I think that information is not available until the process is created due to ASLR.
- userbinator 2y agoDue to ASLR, those addresses wouldn't be useful either as they would change with the next process created.
- omoikane 2y agoWell, the addresses won't be constant, but maybe some people find those addresses to be useful for something, e.g. they want to check if ASLR is enabled. I just tried this and I get different addresses every time I ran `ldd /bin/true` on Linux, but I always get back the same addresses on Windows.
- pjmlp 2y agoNote that Aix is a UNIX that shares the Windows dynamic libraries model. ELF like libraries are supported, but not the way most things are expected to work, with XCOFF and export description files. Symbian was another OS with similar model, but it wasn't a UNIX anyway, and PIPS was a compatible layer on top.