News for hackers. Stuff that matters.
Re:32-bit x86 Position Independent Code – It's That Bad by pilif on Wednesday April 15, 2015 @02:38AM (#9379236)
IMHO, static linking, be it using a mechanism alike what npm is doing or be it plain-old static linking of binaries also means "you link it, you own it".

For every package, you link statically, you as the parent package owner become responsible for all security flaws of all the packages you link statically.

And by "responsible" I mean: Every dependent security announcement of a dependent package also becomes your security announcement.

If you're AWESOMY 1.1 and you link statically against openssl and openssl announces a security flaw, then you better and quickly release AWESOMY 1.1.1 with an accompanying security announcement too.

Are you willing to do this? Do you trust the chain of dependencies all the way down to also be willing to do the same?

As a responsible developer, I'd much rather delegate that responsibility away to a packager or even the user, especially with well-known libraries like openssl.

If I'm owning AWESOMY 1.1 and link dynamically against openssl, then I don't have to do anything when openssl releases a security announcement. I can, if I want to, inform my users to maybe update openssl, but with some likelihood they are already doing this anyways for some other package.

For me as a developer, this is considerably more convenient.

Yes. Static linking has huge advantages for me as a developer too, but it also comes with a great many additional responsibilities I'm personally not willing to take on, also because I don't trust my dependencies to be as diligent about their dependencies.

Re:32-bit x86 Position Independent Code – It's That Bad by roghummal on Wednesday April 15, 2015 @05:15AM (#9379754)
At least on Linux, (commercial) people are packaging shared libs with their binary and using LD_PRELOAD wrappers anyway. "Own-it-by-proxy"-except-you're-shipping-it-so-you-kinda-own-it-anyway.

Dynamically linked, dlopen()-or-equivalent plugin designs are an exception. Otherwise, I'd like to see more statically-linked applications.

Re:32-bit x86 Position Independent Code – It's That Bad by bandrami on Wednesday April 15, 2015 @04:08AM (#9379497)
For every package, you link statically, you as the parent package owner become responsible for all security flaws of all the packages you link statically

Well, speaking as an administrator rather than a developer: a developer shouldn't be making that kind of policy decision (time of symbol resolution) to begin with barring a strong technical need (plug-in based architecture, etc.).

I mean, 90% of packages don't care whether their libraries are dynamic or static, but the ones that do can still be annoying. (Coreutils, of all things, requires dynamic linkage for stdbuf, though that seems to be considered a bug by the maintainer; on the other end of the spectrum, getting Perl to even build statically is like pulling teeth, and that was a design decision.)

Do you trust the chain of dependencies all the way down to also be willing to do the same?

The only time that is a problem is those cases where the package developer literally plunks down a bunch of code from his upstream into his own tree (think the embedded glib inside pkg-config, or the hideous monstrosity that is gnulib). I think all sane people agree this is bad -- if you aren't significantly altering the code (at which point it's "yours") there's no sense in doing that and risking a sync problem. But that's not even static linkage; that's just literal code-sharing.

Re:32-bit x86 Position Independent Code – It's That Bad by vetinari on Wednesday April 15, 2015 @07:52AM (#9380257)
The embedded glib inside pkg-config solves the chicken-egg problem: pkg-config requires glib and glib requires pkg-config. This way, you can build pkg-config first with its embedded glib, then glib itself and then go solve your own problems, instead of butchering the build system to make them build at all.
Re:32-bit x86 Position Independent Code – It's That Bad by bandrami on Thursday April 16, 2015 @05:14AM (#9386725)
Oh, true, and I didn't mean that as a criticism of pkg-config; they only did that because it was literally the only option. In general you should only duplicate actual code if it's the only option, was my point; pkg-config is the pattern and gnulib is the anti-pattern in that.
Re:32-bit x86 Position Independent Code – It's That Bad by deweerdt on Wednesday April 15, 2015 @02:49AM (#9379261)
I believe that what you describe is the remaining argument in favor of dynamic linking.

That said, I'd like to point out that it is convenient for the developer - since customers are ultimately interested to know if your software is vulnerable, and you'll have to explain how the vulnerability affects it -.

It's also a double edged sword: openssl has a good ascending compatibility record, but that can't be said about all user space libraries. IOW, it's tricky to guarantee that your software will work flawlessly across all the incarnations of CentOS 6.x, if you have a lot of external dependencies, for example.

Re:32-bit x86 Position Independent Code – It's That Bad by danieldk on Wednesday April 15, 2015 @03:10AM (#9379335)
IOW, it's tricky to guarantee that your software will work flawlessly across all the incarnations of CentOS 6.x,

It's not so tricky, since Red Hat specifies nowadays what guarantees can be expected for what packages:

https://access.redhat.com/articles/rhel-abi-compatibility#Ap...

Re:32-bit x86 Position Independent Code – It's That Bad by pjc50 on Wednesday April 15, 2015 @04:36AM (#9379590)
Dynamic linking is required for anything resembling a plugin architecture (such as PAM).
Re:32-bit x86 Position Independent Code – It's That Bad by wtbob on Wednesday April 15, 2015 @08:06AM (#9380342)
Not really—one could use processes and some form of IPC (shared memory, pipes, whatever). The efficiency could be pretty bad, but the safety and reliability could be better.
Re:32-bit x86 Position Independent Code – It's That Bad by JoachimSchipper on Wednesday April 15, 2015 @09:52AM (#9380934)
In fact, OpenBSD delegates logins to a login_<foo> binary, e.g. http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/.... That works. OpenBSD's system is not as flexible as PAM, with the attendant upsides and downsides.
Re:32-bit x86 Position Independent Code – It's That Bad by bandrami on Wednesday April 15, 2015 @12:39PM (#9382199)
Yeah. There's a reason I stick with OpenBSD.

I have absolutely no need for my authentication system to be "flexible".

Re:32-bit x86 Position Independent Code – It's That Bad by StillBored on Wednesday April 15, 2015 @03:17PM (#9383406)
"And by "responsible" I mean: Every dependent security announcement of a dependent package also becomes your security announcement."

Yes, and no, because as the developer you can look at the security vulnerability and decide if its actually exploitable in your application. That is assuming you can determine it, but in a lot of cases its simple. Especially in a huge library like openSSL. Say for example the only thing i'm using openSSL for is some limited functionality, say SHA256, then I probably can ignore 99.99% of the security issues because they just won't apply.

I've been in this situation with an embedded platform that ships as part of the product I work on. Its pretty much got daily security updates, and yet we rarely get hit by any of them because our usage of the platform is like 1% of its functionality.