linux - File/Calls substitution like LD_PRELOAD -
does there usual utility makes substitution on calls execve , open? ld_preload calls.
example:
usual solution next:
$: mv /usr/bin/prog_b /usr/bin/prog_b.new $: ln -s /usr/bin/prog_b.old /usr/bin/prog_b $: ./prog_a # run
but it's uncomfortably , dirty solution. in stories correct way so:
$: util "execve+open+stat:/usr/bin/prog_b=/usr/bin/prog_b.old" ./prog_a
where execve,open & stat system calls. name of util?
i write special file_preload utility solve problem.
$: file_preload -c "execve+open+stat:/usr/bin/prog_b:/usr/bin/prog_b.old" ./prog_a
it generates c++ code, compiles , ld_preload result lib.so file before run ./prog_a.
using can hook next calls:
- open,fopen,fopen64
- opendir,mkdir,rmdir
- execve
- unlink,unlinkat
- stat,lstat,lstat64,_lxstat,_lxstat64,stat64
- _xstat,_xstat64,__fxstatat
- freopen,freopen64
please, run docs/tut.sh firstly (it's tutorial fp utility).
Comments
Post a Comment