-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent cross-version linkage while allowing multiple versions of *ring* to be used in the same program #535
Comments
FWIW This is a problem for all crates that have C dependencies, especially those that vendor the code! For example libgit2-sys builds and links in the libgit2 library that Cargo uses, and two major version of the libgit2-sys crate would cause lots of problems (lots of duplicate symbol with differing versions of libgit2). For native dependencies at least Cargo has a A downside of this approach, though, is that the error messages aren't the best. Historically, for example, Hyper's received a lot of bug reports when the openssl-sys crate has a major version bump. The actual problem was in totally different crates, but Hyper got the brunt of the issues as it's transitively the main point through which the openssl-sys crate was used. Given the rate of releases for ring (which is great!) it'd be awesome for all versions to be able to coexist in the same binary so you don't have to upgrade the whole world all at once. The Rust compiler handles this (as you've found) by mangling the symbol names. Would it be possible for ring to do the same? Basically just append a "unique string" somewhere in each symbol name exposed by the library. If you're curious about that and need help on the build script and/or Rust side of things to avoid duplication and whatnot, I wouldn't mind helping out! |
Thanks for that explanation! I had no idea about that. I added the As things currently stand, I only support the latest release of ring, so supporting programs containing multiple versions at once is out of scope. I already yanked all versions except {0.7.6, 0.8.1, and 0.9.4} and I plan on yanking 0.7.6 and 0.8.1 RSN. |
OK, I think everything we need to do is done here. |
Out of curiosity, do you have an idea for how much work it would take to lift the restriction of requiring Right now they way that version resolution works out means that if you have a major version upgrade of a dependency with a If it's easy-ish to lift the restriction by requiring |
I only support the latest version of ring, so linking two versions of ring into the same program is an unsupported configuration which means we don't expend effort on it. We did a couple of experiments showing that the major version bumps don't seem to cause significant problems for downstream users. So, it seems like something that at first would be nice to do, but AFAICT it's a net negative. |
It causes a problem if some end user wants to build an executable using |
@briansmith Being able to link two versions of The current state of affairs forces a lock-step upgrade of dependencies. Consider what Rocket had to do to upgrade from Thankfully, @ctz owns Additionally, |
I think the current state is fine and I frankly don't want to spend much effort on this. However, that said, perhaps other people are willing to spend effort to come up with a reasonable solution. Here are the requirements for the feature: Must be Automatic, except possibly for small configuration changes just prior to
|
Ok. I'm on it. |
(Or something like it). Rocket and jsonwebtoken depend on different versions of `cookie`, and those two versions depend on different versions of `ring`, and `ring` has a policy of not being linked more than once into a binary. You'll get an error like this: ``` error: multiple packages link to native library `ring-asm`, but a native library can be linked only once package `ring v0.11.0` ... which is depended on by `cookie v0.9.2` ... which is depended on by `rocket v0.3.9` ... which is depended on by `changes v0.1.0 (file:///home/coleman/Code/Rust/changes)` links to native library `ring-asm` package `ring v0.12.1` ... which is depended on by `jsonwebtoken v4.0.1` ... which is depended on by `changes v0.1.0 (file:///home/coleman/Code/Rust/changes)` also links to native library `ring-asm` ``` My workaround: fork `jsonwebtoken` and depend on an older `ring` that Rocket transitively depends on, v0.11.0 Refs: briansmith/ring#619 briansmith/ring#535
Running into the same issue found here - rwf2/Rocket#492 Is there any kind of ETA on this? Would love to get a project I have to move forward with this. Appreciate the effort 👍 |
I have been chasing this conversation, going in circles, for an hour now! This is important. I want to upgrade the version of Rocket, but other libraries have dependencies on Ring that cause a conflict. Have we inadvertently reinvented a version of DLL-HELL in Rust? |
@SergioBenitez @1wilkens: Has there been any progress on this ticket? If someone can provide an update on the state of the items @briansmith suggested here, I'm willing to help out to drive this to completion. I think it's pretty critical for the Rust ecosystem. |
My Travis CI changes and hacky python script are still in a PR somewhere. Until now I didn't check BoringSSL's prefixing scheme, as I stopped using |
thanks for the update! I have a branch (https://github.com/ramosbugs/ring/tree/version_symbols) that's almost working with BoringSSL's changes, but with @briansmith's preferred approach of pregenerating any of the files that require Go/Perl tools. I should have a PR out soon, hopefully later today. |
If you've come here because you hit this problem with rocket, see below. If you are not using the secure cookies feature in rocket, you can disable it and therefore the tied
|
I'm not even sure which issue is supposed to be tracking this problem any more, but PR #1267 aims to ensure that ring 0.17 .x can coexist with an earlier version of ring in the same executable, and it lays the groundwork for a fully automated solution. |
I'm going to close this issue. A long time ago I did implement a solution that does "prevent cross-version linkage." Now most people are interested in this issue because they didn't like that solution. Issue #1268 outlines the new solution and links to the PR that will allow the problems to be solved. |
I guess it is possible for people to somehow link two versions of ring into a program with unpredictable results. Part of the unpredictability of this is that the C/asm code in ring might have different ABI across versions, but the linker does not know that. Presumably it is less of an issue for Rust code because Rust function names are mangled and so if their ABI changes, the linker won't confuse two versions of a function.
It isn't ring's responsibility to prevent these issues from happening, but I have an idea that might help with this.
The text was updated successfully, but these errors were encountered: