dynamic-loader | simple Linux dynamic loader capable of loading simple | Build Tool library
kandi X-RAY | dynamic-loader Summary
kandi X-RAY | dynamic-loader Summary
A simple Linux dynamic loader capable of loading simple binaries using simple shared libraries (no glibc support obviously, also the musl-gcc hacks in the build system are heavily ArchLinux specific)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dynamic-loader
dynamic-loader Key Features
dynamic-loader Examples and Code Snippets
Community Discussions
Trending Discussions on dynamic-loader
QUESTION
After reading these questions, I'm looking for some more detail about how to control symbol resolution order.
In my problem, I have main executable exec
. exec
dynamically links to a.so
and c.so
. a.so
dynamically links to b.so
. b.so
calls function foo
, which is normally provided by c.so
but in this case is also provided by exec
. b.so
only works with c.so
's implementation of foo
.
A diagram of the situation:
...ANSWER
Answered 2017-Jan-07 at 05:54Unfortunately there is no way to tweak symbol resolution at per-library level so there is not easy way to achieve this.
If foo
is actually implemented in main executable (not just copy-relocated to it) there's nothing you can do because symbols from main executables get the highest priority during resolution (unless you are ok with ultimately hacky runtime-patching of GOT which you aren't).
But if
foo
is implemented in c.so- and you are desperate enough
you could do the following:
- get return address inside interceptor in a.so (use
__builtin_return_address
) - match it against boundaries of b.so (can be obtained from
/proc/self/maps
) - depending on result, either do special processing (if caller is in b.so) or forward call to
RTLD_NEXT
This of course has obvious limitations e.g. won't work if b.so calls function from yet another d.so which then calls foo
but it may be enough in many cases. And yes, I've seen this approach deployed in practice.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dynamic-loader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page