Skip to content

San7o/ld-preload-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ld-preload-sample
=================

Sample program to replace glibc functions (malloc and free) with
custom implementations before execution using LD_PRELOAD. Works with
any shared library function.

Author:  Giovanni Santini
Mail:    giovanni.santini@proton.me
License: MIT


Usage
-----

Normal execution:

   make run

Execution with LD_PRELOAD:

   make run-preload


Explaination
------------

Before executing a program (but after its compilation), the linux
dynamic linker `ld-linux.so` finds and loads the shared libraries
needed by a program, prepare the program to run, and then run it. If
an environment variable `LD_PRELOAD` is specified, the dynamic linker
will load the symbols from the libraries specified in the variable
first (even before the libc). We can use this to replace some
functions with a custom implementation.

About

Sample program to replace glibc functions (malloc and free) with custom implementations before execution using LD_PRELOAD. Works with any shared library function.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors