linux - File/Calls substitution like LD_PRELOAD -


does there usual utility makes substitution on calls execve , open? ld_preload calls.

example:

  • have prog_a uses prog_b.
  • days ago prog_b updated , prog_a failed!(
  • 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:

    1. open,fopen,fopen64
    2. opendir,mkdir,rmdir
    3. execve
    4. unlink,unlinkat
    5. stat,lstat,lstat64,_lxstat,_lxstat64,stat64
    6. _xstat,_xstat64,__fxstatat
    7. freopen,freopen64

    please, run docs/tut.sh firstly (it's tutorial fp utility).


    Comments

    Popular posts from this blog

    linux - Does gcc have any options to add version info in ELF binary file? -

    android - send complex objects as post php java -

    charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -