News for hackers. Stuff that matters.
Re:Never run ldd on unknown executables by userbinator on Sunday July 23, 2023 @09:48PM (#36842106)
The fact that an executable needs to explicitly specify the "interpreter", instead of that being something under control of the OS loader, doesn't seem like a good way of doing it; and then the implementation of ldd discussed here just takes it in an even weirder direction.
Re:Never run ldd on unknown executables by dap on Sunday July 23, 2023 @10:47PM (#36842558)
What distinction are you making? Do you think it should be part of the kernel? I ask because ld.so (the runtime linker/loader) is part of the OS on many systems.
Re:Never run ldd on unknown executables by userbinator on Sunday July 23, 2023 @11:59PM (#36842986)
I mean not explicitly hardcoding the path to the interpreter inside every binary. If the dynamic linker is part of the OS, then surely the OS should already know where it is?
Re:Never run ldd on unknown executables by throwawaylinux on Monday July 24, 2023 @02:22AM (#36843754)
How much do you actually know about this? Have you read the ELF spec or written anything with libelf, hacked on a loader, a linker? Considered the actual problems with having this hard coded vs alternatives?

I ask because ELF and unix dynamic linking is a pretty well thought out set of specifications and processes and it's a huge body of work. It can certainly be criticized, but calling it an afterthought because of .interp doesn't seem very charitable.

There actually

Re:Never run ldd on unknown executables by duped on Monday July 24, 2023 @06:43AM (#36845700)
> If the dynamic linker is part of the OS, then surely the OS should already know where it is?

It's both part of the OS and the language's compiler tool chain the program was written in. For the vast majority of Linux executables that's glibc and the ld-linux.so that glibc ships.

And you don't need to hard code the path inside your executable. Static PIE objects for example are dynamic elf objects without an interpreter header. The system loader is capable of launching them just fine.

Re:Never run ldd on unknown executables by dap on Monday July 24, 2023 @02:34PM (#36852412)
I’m still not sure what principle you’ve got that’s being violated here? Given that one has chosen to implement part of the runtime linker/loader in userland, what’s wrong with fitting that into a more generic facility (supporting interpreters at arbitrary paths) and putting this specific implementation into a committed path?
Re:Never run ldd on unknown executables by throwawaylinux on Sunday July 23, 2023 @11:29PM (#36842797)
> The fact that an executable needs to explicitly specify the "interpreter", instead of that being something under control of the OS loader, doesn't seem like a good way of doing it;

The OS loader does control the permissions of what can be read and executed. And the user can execute a file. Why would it be better if you had to execute the loader explicitly to run a program? The same security problem would apply if you convinced somebody else to execute your malicious code. Seems like pretty harmless syntactic convenience.

The issue of ldd executing the program I guess is a thing that could be tightened to avoid foot shooting. Lots of unix programs traditionally were happy to give you lots of rope though.