|
From: John R. <jr...@bi...> - 2012-12-12 23:02:36
|
> But, since we want to still call the original version of calloc, we > allocate a buffer to save the first instruction (orig_calloc): > > orig_calloc: > instruction1 > jmp calloc+1 > > I believe that the problem is that valgrind has a redirection for > calloc, that is: > > calloc -> _vgr10070ZU_libcZdsoZa_calloc > > But after "moving" the start of calloc to orig_calloc, we want: > > orig_calloc -> _vgr10070ZU_libcZdsoZa_calloc You control orig_calloc, so what is stopping you? > > Is there a way to reassign redirections? The routine calloc_hijacker could check whether the instruction layout remains the same as the first time, deduce that valgrind is active, and re-arrange the code further. (Remember to sync the Icache; on x86 any backwards branch suffices, but on other architectures a system call is necessary.) -- |