News for hackers. Stuff that matters.
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @11:31AM (#18600904)
I've never gotten the hate for static linking, which would avoid issues like this. You'd always have the version of your dependencies that you're expecting.

Also, dynamic linking completely neuters LTO. There's not much point to (theoretically) saving a few megabytes of RAM when you're pulling in twice as much unused code.

Re:A Not-Called Function Can Cause a 5X Slowdown by cesarb on Tuesday December 04, 2018 @01:13PM (#18602024)
> I've never gotten the hate for static linking

I believe most of the dislike for static linking can be traced to a single incident: a really bad (as in "remote code execution" bad) vulnerability in zlib, CVE-2002-0059. Back then, it was common to statically link to zlib (and zlib is a very popular library, the DEFLATE algorithm it implements being the "standard" compression algorithm), so instead of just replacing a single dynamic library and rebooting, everything had to be audited for the presence of embedded copies of zlib.

Quoting from a message from a few years later (http://mail.openjdk.java.net/pipermail/build-dev/2007-May/00...):

"[...] Updating the main system zlib package was easy, but finding all the embedded copies was a nightmare. I think we ended up grepping every binary and library in every package for symbols and other bits of code that looked like zlib. All the different versions involved compounded this. And when everything is found and patched and built and tested there's the cost of bandwidth to distribute all the extra stuff. So when people talk of removing static libraries they're talking about real costs -- time and money. After zlib there was a definite feeling of "never again"."

Re:A Not-Called Function Can Cause a 5X Slowdown by Hello71 on Tuesday December 04, 2018 @01:34PM (#18602246)
That's not a complaint about static linking though, that's a complaint about library embedding. Lots of Professional Enterprise Software as well as poorly designed games use a buttload of dynamic linking, but a few patches here and there and some API/ABI ignorance later, the libraries are impossible to replace.
Re:A Not-Called Function Can Cause a 5X Slowdown by TFortunato on Tuesday December 04, 2018 @03:06PM (#18603164)
Unfortunately, this is conflating static linking with bad dependency management. ("Just copy it into your own repo", is a different step, that is unnecessary to do the second step, "and link it statically")

There is no reason I see why you couldn't just have a build that produces the library .a file for zlib, which can then be pulled in as a dependency of your build / linked in statically.

I totally agree, they had a nightmare situation on their hands, but I don't think static linking was solely to blame :-)

Re:A Not-Called Function Can Cause a 5X Slowdown by tedunangst on Tuesday December 04, 2018 @03:51PM (#18603497)
I have 100s of binaries on my system. Which ones do I need relink?
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @04:15PM (#18603663)
You can write a script to look at package files' makedepends, and rebuild everything that uses the offending library.
Re:A Not-Called Function Can Cause a 5X Slowdown by tedunangst on Tuesday December 04, 2018 @03:54PM (#18603516)
> There's not much point to (theoretically) saving a few megabytes of RAM when you're pulling in twice as much unused code.

But there is. The unused code is still shared.

Re:A Not-Called Function Can Cause a 5X Slowdown by caf on Tuesday December 04, 2018 @10:13PM (#18605431)
...and the libraries are typically demand-paged as well, so the truly unused stuff isn't even resident.
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Wednesday December 05, 2018 @12:56PM (#18610667)
That would assume that used and unused code aren't mixed within pages.
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @04:18PM (#18603678)
That might make a marginal difference if you have large libraries that are used in a large number of applications that run concurrently. Otherwise, the sharing is completely pointless.
Re:A Not-Called Function Can Cause a 5X Slowdown by pathseeker on Tuesday December 04, 2018 @11:49AM (#18601107)
>I've never gotten the hate for static linking

vulnerabilities

Re:A Not-Called Function Can Cause a 5X Slowdown by DrScientist on Tuesday December 04, 2018 @12:23PM (#18601465)
Sure - but most computers are used by people who are the sole user, so local user to user security as a concept isn't useful.

Most code isn't part of the remote attack surface.

Also there would be no software bugs if bugs only existed in the past... ie bugs come with updates, not just fixed by updates.

There are trade offs, and Linux developers decided to make it what was easiest for them and remove the ability for the user to choose.

If there wasn't a need for stability and isolation then docker et al wouldn't exist.

Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @01:28PM (#18602192)
Based on what cesarb said, that's a problem with the build system.