-
Notifications
You must be signed in to change notification settings - Fork 7
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
Isolate feature doesn't work with $ORIGIN
in DT_RUNPATH
#38
Comments
Side note: I probably could have gotten this to work with a dylib instead of a cdylib, but I was really struggling to get it to work at all and figured cdylibs were probably more widely used. Even so I could never get |
Thanks for reporting this! Just to summarize:
So I think that, as you mentioned, setting the LD_ORIGIN_PATH environment variable should probably work - did you try setting it in the Another option would be to bindmount the dylib to If LD_ORIGIN_PATH works, I think it would probably be best if I made |
Basically yes, it uses the system search path which is not relative to But yes, your summary seems accurate.
If you put an absolute path in
OK, I just tried that, and it did not seem to work. Specifically I tried let mut env = HashMap::new();
env.insert("LD_ORIGIN_PATH".to_owned(), "/home/cdruid/src/extrasafe_example/example/target/debug".to_owned());
let output = Isolate::run("isolate_print", &env).unwrap(); and got
Which is the same behavior despite Apparently according to https://www.technovelty.org/linux/exploring-origin.html To be clear: for me this is an academic exercise; I simply got curious while reading your blog post and wanted to share what I learned. This bug isn't blocking me or anything like that. |
That is unfortunate. I think probably the best thing to do if someone were in this situation would just be to use patchelf to fix the library path to not be dynamic. Anyway, thanks for reading my blog post and teaching me about $ORIGIN! |
While reading the blog post at https://harrystern.net/extrasafe-user-namespaces.html I thought to myself: that doesn't sound like it would work, because it would mess up how binaries find their shared libraries when they set a
DT_RUNPATH
with$ORIGIN
in it.I thought it would be quick to check this by whipping up a quick paired dylib + binary crate, but I was very wrong about how quick it would be.
But after hours of futzing with things, I managed to get a binary which the dynamic loader loads fine outside the isolated environment, but fails inside:
It goes like:
Then we just need some final hackery to set up
DT_RUNPATH
:Which gives me:
and looking inside
strace -f
I can see the working open at the top:followed by the broken one down below:
Looking through
man ld.so
, it looks like the fix might be as simple as settingLD_ORIGIN_PATH
based ondirname $(readlink /proc/self/exe)
The text was updated successfully, but these errors were encountered: