TABLE OF CONTENTS
1. The problem
1.1 What does redirecting mean?
1.2 Why redirecting?
2. Brief ELF explanation
2.1 Which parts does ELF file consist of?
2.2 How do shared ELF libraries link?
2.3 Some useful conclusions
3. The solution
3.1 What is the algorithm of redirection?
3.2 How to get the address, which a library has been loaded to?
3.3 How to write and restore a new function address?
4. Instead of conclusion
5. Useful links1. The problemWe all use Dynamic Link Libraries (DLL). They have excellent facilities. First, such library loads into the physical address space only once for all processes. Secondly, you can expand the functionality of the program by loading the additional library, which will provide this functionality. And that is without restarting the program. Also a problem of updating is solved. It is possible to define the standard interface for the DLL and to influence the functionality and the quality of the basic program by changing the version of the library. Such methods of the code reusability were called “plug-in architecture”. But let’s move on. Of course, not every dynamic link library relies only on itself in its implementation, namely, on the computational power of the processor and the memory. Libraries use libraries or just standard libraries. For example, programs in the C\C++ language use standard C\C++ libraries. The latter, besides, are also organized into the dynamic link form (libc.so and libstdc++.so). They are stored in the files of the specific format. My research was held for Linux OS where the main format of dynamic link libraries is ELF (Executable and Linkable Format). Recently I faced the necessity of intercepting function calls from one library into another - just to process them in such a way. This is called the call redirecting.Read more: Codeproject
1. The problem
1.1 What does redirecting mean?
1.2 Why redirecting?
2. Brief ELF explanation
2.1 Which parts does ELF file consist of?
2.2 How do shared ELF libraries link?
2.3 Some useful conclusions
3. The solution
3.1 What is the algorithm of redirection?
3.2 How to get the address, which a library has been loaded to?
3.3 How to write and restore a new function address?
4. Instead of conclusion
5. Useful links1. The problemWe all use Dynamic Link Libraries (DLL). They have excellent facilities. First, such library loads into the physical address space only once for all processes. Secondly, you can expand the functionality of the program by loading the additional library, which will provide this functionality. And that is without restarting the program. Also a problem of updating is solved. It is possible to define the standard interface for the DLL and to influence the functionality and the quality of the basic program by changing the version of the library. Such methods of the code reusability were called “plug-in architecture”. But let’s move on. Of course, not every dynamic link library relies only on itself in its implementation, namely, on the computational power of the processor and the memory. Libraries use libraries or just standard libraries. For example, programs in the C\C++ language use standard C\C++ libraries. The latter, besides, are also organized into the dynamic link form (libc.so and libstdc++.so). They are stored in the files of the specific format. My research was held for Linux OS where the main format of dynamic link libraries is ELF (Executable and Linkable Format). Recently I faced the necessity of intercepting function calls from one library into another - just to process them in such a way. This is called the call redirecting.Read more: Codeproject
0 comments:
Post a Comment