Skip to content

Instantly share code, notes, and snippets.

@aagontuk
Created April 27, 2022 06:44
Show Gist options
  • Save aagontuk/08764277696a7e801ffa34f432273ffc to your computer and use it in GitHub Desktop.
Save aagontuk/08764277696a7e801ffa34f432273ffc to your computer and use it in GitHub Desktop.
Intercept libraries and system calls

Override malloc with LD_PRELOAD

Main issue is handling the recursive calls inside malloc. If you use printf in malloc that might cause issue as printf itself calls malloc for memory allocation resulting infinite recursion. On the other hand in some cases ld.so uses calloc internally. This alos result in infinite recursion.

Intercepting Linux System calls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment