writejump() needs to tell valgrind which piece of code has been
modified.
This commit is contained in:
parent
9ea3c2d3ee
commit
5548822a7d
|
@ -44,6 +44,9 @@
|
||||||
#ifdef HAVE_SCHED_H
|
#ifdef HAVE_SCHED_H
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||||
|
#include <valgrind/memcheck.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NPTL
|
#ifdef HAVE_NPTL
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -424,6 +427,10 @@ static inline void writejump( const char *symbol, void *dest )
|
||||||
addr[0] = 0xe9;
|
addr[0] = 0xe9;
|
||||||
*(int *)(addr+1) = (unsigned char *)dest - (addr + 5);
|
*(int *)(addr+1) = (unsigned char *)dest - (addr + 5);
|
||||||
mprotect((void*)((unsigned int)addr & ~(getpagesize()-1)), 5, PROT_READ|PROT_EXEC);
|
mprotect((void*)((unsigned int)addr & ~(getpagesize()-1)), 5, PROT_READ|PROT_EXEC);
|
||||||
|
|
||||||
|
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||||
|
VALGRIND_DISCARD_TRANSLATIONS( addr, 5 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue