-
-
Notifications
You must be signed in to change notification settings - Fork 172
Handle errors in shared object loading #1461
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
base: master
Are you sure you want to change the base?
Conversation
ce29a93 to
3271f37
Compare
|
I'm not sure and can't test while not at home, but I think this might address the issue in #1431. |
| if(!result) { | ||
| if (verbose || stillSlightlyVerbose) | ||
| mlibc::infoLogger() << "rtld: failed to open " << name << frg::endlog; | ||
| frg::destruct(getAllocator(), object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could return a unique_ptr<SharedObject> to avoid the need for manual frg::destruct.
| break; | ||
| auto rpathResult = processRpath(path); | ||
| if (rpathResult) { | ||
| res = trySharedObjectSetup(rpathResult.value().get<0>(), rpathResult.value().get<1>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it make more sense to propagate the error if the open succeeds and the load fails? Basically, why don't we handle this like in the last case?
| if (rpathResult) | ||
| res = trySharedObjectSetup(rpathResult.value().get<0>(), rpathResult.value().get<1>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise.
This PR aims to have the dynamic linker tolerate failures in opening a shared object, in which case it should continue going down its list of paths to find an appropriate shared object.
This can reasonably occur in the wild, as for instance RPATHs can point to broken shared objects. Alternatively, I have encountered the case on my machine (Fedora) where the first
libgcc_s.so.1found is actually for i386, which is rejected, and further down the list of library paths the x86_64libgcc_s.so.1is found.