-
Notifications
You must be signed in to change notification settings - Fork 368
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
Try to respect RPATHS of calling dlopen modules with dlinfo #549
base: main
Are you sure you want to change the base?
Conversation
837e7b2
to
60846e3
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #549 +/- ##
==========================================
+ Coverage 92.55% 92.83% +0.28%
==========================================
Files 91 91
Lines 11304 11153 -151
Branches 1581 2024 +443
==========================================
- Hits 10462 10354 -108
+ Misses 837 799 -38
+ Partials 5 0 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
60846e3
to
7fe623e
Compare
This commit is just for backup on our main strategy of using dlinfo instead of dlopen. Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
7fe623e
to
bd0a8bf
Compare
if (name == nullptr || name[0] == '\0') { | ||
continue; | ||
} |
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.
I don't think this is correct - an empty entry is relative to $PWD, and skipping over that entry but continuing to search other directories after it might mean we load the wrong file.
if (stat(dlname, &dlstat) == 0 && stat("/proc/self/exe", &exestat) == 0 | ||
&& dlstat.st_dev == exestat.st_dev && dlstat.st_ino == exestat.st_ino) | ||
{ | ||
dlname = nullptr; | ||
} |
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 is potentially error prone - it'll miss the case where the executable has been unlinked, at least (/proc/self/exe
is a broken symlink in that case).
What if we instead checked if dladdr(dlsym(dlopen(nullptr), "main"))
has the same dli_fname
as dladdr(callerAddr)
?
This commit is just for backup on our main strategy of using dlinfo
instead of dlopen.
Issue number of the reported bug or feature request: #
Describe your changes
A clear and concise description of the changes you have made.
Testing performed
Describe the testing you have performed to ensure that the bug has been addressed, or that the new feature works as planned.
Additional context
Add any other context about your contribution here.