News for hackers. Stuff that matters.
Re:I Built an Ld_preload Worm by josephg on Tuesday April 30, 2024 @01:14AM (#40207463)
I go back and forth on this.

On MacOS, I do like that the UI libraries for all applications are shipped with the OS. When the OS updates, the UI for all installed programs updates to include the new look and feel. Apple can also update them to change the way that applications render to the screen.

These libraries are quite large, and they probably shouldn't be shipped with every application. If they were, it would make it a lot harder to compile an app to work with multiple versions of macos. Apps would probably break a lot more when the OS updates.

For shell scripts and such, I agree and I'd be happier if everything was statically linked.

My biggest criticism of dynamic linking is how ridiculous the situation is on debian and similar OSes. Imagine if I make some software with rust (or javascript or python or something). My software might pull in 20-100 dependencies from cargo, npm, pip, etc. If I want my software to appear in apt, the debian maintainers insist on adding a mirror of all of those dependencies into apt. So apt sort of maintains a crappy, out of date mirror of a bunch of other language-specific package managers. And as far as I know, they do this work by hand - adding misery to misery.

Nobody wants that. Least of all the software developers - who will get bug reports for their own software compiled with mysteriously out-of-date dependencies that they aren't testing themselves. Its horrible.

Re:I Built an Ld_preload Worm by AnonymousPlanet on Tuesday April 30, 2024 @04:55AM (#40208690)
I don't understand what you think pip, npm etc. have to do with dynamic linking. Those libraries get loaded in the respective interpreter, the linker doesn't come into action at all. And security wise npm, pip and the likes are nightmares waiting to be exploited xz style. No static linking will save you from it.
Re:I Built an Ld_preload Worm by josephg on Tuesday April 30, 2024 @09:02AM (#40210570)
It maps.

If you throw a nodejs or python package in apt, you can either include all of its js / python dependencies in the package itself or make separate apt packages for each of the projects dependencies and have the apt package depend on those packages. The difference is pretty similar to static / dynamic linking. Including the dependencies gives the package author explicit control over the versions of all your dependencies. But depending on external apt packages means you can install security updates to shared libraries system wide. (Think log4j or xz). And as I understand it, that is what Debian prefers.

In JavaScript projects it’s even become common practice to use a bundler to “compile” server side JavaScript (with all your dependencies) into a single large unreadable .js file. Doing that can reduce memory usage and dramatically improve startup time. The bundled code usually has dead code elimination. It’s more or less identical to static linking - except the resulting artifact is another JavaScript file.

Re:I Built an Ld_preload Worm by AnonymousPlanet on Tuesday April 30, 2024 @01:04PM (#40213297)
Ah, it was an analogy. That makes sense, thanks!
Re:I Built an Ld_preload Worm by cozzyd on Tuesday April 30, 2024 @10:47AM (#40211514)
well, how do you handle multi-language dependencies? You can't tell pip about a cargo project, instead you mirror it on pip anyway...