• omoikane an hour 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
    • ReleaseCandidat 2 hours ago

      Each Elf executable can have its own "interpreter" (loader, which as default is `ld-linux. so`), so without calling the configured interpreter ldd can't know about the dependencies of such "special" executables. And the configured interpreter can be any program, AFAIK there are no limititations in the ELF format.

      • quotemstr an hour ago

        Yes, but in the vast majority of cases the interpreter is ld-linux.so (or the Buonic/Musl equivalent) and a safe binary inspection tool can know for sure what that interpreter will do. It's okay for that tool to say "I don't know" 0.0001% of the time.

        • ReleaseCandidat an hour ago

          It wasn't meant as an argument against not loading the interpreter, but an explanation why it is "normal" - but if course insecure - behavior for ldd to execute the configured interpreter.

      • aleden 2 hours ago

        Disentangling who loads what without actually running the app, i.e. allowing a sequence of dlopen() calls to succeed, seems impossible to accomplish in the presence of binary code which cannot be effectively scrutinized.

        • ReleaseCandidat 2 hours ago

          It's not about calling the app itself - that doesn't happen with ldd. ldd does not know about dlopened libraries.

          • aleden 2 hours ago

            I guess I wasn't sure that DT_NEEDED entries covered everything. Sometimes you have stuff that happens in DT_INIT constructors.

            • ReleaseCandidat 2 hours ago

              Dynamic dlopen calls do not appear in the ELF at all, these are "normal" function calls.

              • sim7c00 an hour ago

                correct. you cam call dlopen anywhere so loading it into memory or even executing all easy to reach paths wont guarantee you'd get that. you might do full symbolic execution but your 'ldd' might take days or weeks :'D

        • quotemstr an hour ago

          ldd's shortcomings have been well known for years, but here we are. Same with strncpy. It's remarkable how sticky some tools are in people's muscle memory and how hard it is to eradicate these bad tools even when drop in alternatives are within reach. Habit is powerful.

          • ReleaseCandidat an hour ago

            > strncpy

            strncpy had been touted the "safe strcpy alternative" for years.

          • anthk an hour ago

                          objdump -x /path/to/binary | grep NEEDED
            • ReleaseCandidat an hour ago

              It's not same, as ldd does print transitive dependencies too. libtree is comparable to ldd

            • ChoHag 2 hours ago

              This is par for the course for GNU.

              Shit code. Arrogant developers. Shoddy documentation.

              In fact actually documenting that a bad thing could happen when you use a tool normally is a higher bar than GNU's documentation normally reaches.

              • quotemstr an hour ago

                Nah. That's not GNU. It's just the industry. Proprietary stuff can be even worse. Remember how Windows conhost has a crappy rectangle text selection model for literally two decades until Microsoft overcame their stubbornness and fixed it? Being a stick in the mud isn't a feature of GNU in particular. It's an element of human nature.

                • anthk an hour ago

                  How does LDD behave in {net,open,free}bsd?

                • Asooka an hour ago

                  You are getting downvoted, but you're absolutely correct. This is the usual disposition of Unix devs in general I've found. People forever stuck in the mentality that the computer is a personal toy, only for running your code and OS code, who refuse to grow up and accept responsibility for maintaining software useful in the real world. When you point it out they just act like piss-babies, cry and shout until they get their way. We put up with using code that is, as their license reminds us, "without [...] FITNESS FOR A PARTICULAR PURPOSE", simply because the amount of basic operating system services we'd have to rewrite to get rid of them is an extremely daunting task. Hopefully the Rust project can spur some development into replacing GNU and other similar shit, so we can be rid of the drooling retards for good.

                  • quotemstr an hour ago

                    Rust is a young ecosystem. Give it time. It'll ossify too, just like every other previous software ecosystem. We make progress only through continual cycles of replacement and renewal, usually by fresh eyes and fresh hands each cycle. It's always been this way and always will be. One day, Rust will be the difficult to replace ancestral crud.

                • blueflow 3 hours ago

                  Why do people a) have these preconceptions, b) have them be accurate enough to work at all, and c) get away with shouting "but POLA" when they don't work out?

                  • juped an hour ago

                    I'm astonished that this melted sand performs computations, but Shockley closed my CVE "not a bug"