Bugtraq mailing list archives

Re: Clarification: LD_PRELOAD issue


From: JDaniele () KPMG CA (John Daniele)
Date: Sat, 15 May 1999 18:52:53 -0400


/*
  * rollover.c
  *
  * using ptrace() to intercept and modify the return value of a system call
  *
  * John Daniele
  * jdaniele () kpmg ca
  * VOX: (416) 777-3759
  *
  */

#include <unistd.h>
#include <sys/ptrace.h>

int main(void)
{       
        int ret, x, y;
        pid_t procid;

        if(procid = fork()) {           
                for(;;) {
                        x = ptrace(PTRACE_PEEKUSR, procid, 44, 0);
                        if(x == 13) {   
                                y = ptrace(PTRACE_PEEKUSR, procid, EBX,
0);             
                                ptrace(PTRACE_POKEDATA, procid, y,
2175984000);    
                        }
                        ptrace(PTRACE_SYSCALL, procid, 1, 0);   
                }       
        }       
        ptrace(PTRACE_TRACEME, 0, 1, 0);        
        execl("/bin/date", "/bin/date", NULL, (char *)0);
}



Current thread: