> 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.) -- ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users