diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 0c80f8382af..198c5b1d386 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -140,7 +140,9 @@ static BOOL HEAP_IsRealArena( HEAP *heapPtr, DWORD flags, LPCVOID block, BOOL qu static inline void mark_block_free( void *ptr, SIZE_T size ) { if (TRACE_ON(heap) || WARN_ON(heap)) memset( ptr, ARENA_FREE_FILLER, size ); -#ifdef VALGRIND_MAKE_NOACCESS +#if defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_DISCARD( VALGRIND_MAKE_MEM_NOACCESS( ptr, size )); +#elif defined( VALGRIND_MAKE_NOACCESS) VALGRIND_DISCARD( VALGRIND_MAKE_NOACCESS( ptr, size )); #endif } @@ -148,7 +150,9 @@ static inline void mark_block_free( void *ptr, SIZE_T size ) /* mark a block of memory as initialized for debugging purposes */ static inline void mark_block_initialized( void *ptr, SIZE_T size ) { -#ifdef VALGRIND_MAKE_READABLE +#if defined(VALGRIND_MAKE_MEM_DEFINED) + VALGRIND_DISCARD( VALGRIND_MAKE_MEM_DEFINED( ptr, size )); +#elif defined(VALGRIND_MAKE_READABLE) VALGRIND_DISCARD( VALGRIND_MAKE_READABLE( ptr, size )); #endif } @@ -156,13 +160,17 @@ static inline void mark_block_initialized( void *ptr, SIZE_T size ) /* mark a block of memory as uninitialized for debugging purposes */ static inline void mark_block_uninitialized( void *ptr, SIZE_T size ) { -#ifdef VALGRIND_MAKE_WRITABLE +#if defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_DISCARD( VALGRIND_MAKE_MEM_UNDEFINED( ptr, size )); +#elif defined(VALGRIND_MAKE_WRITABLE) VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size )); #endif if (TRACE_ON(heap) || WARN_ON(heap)) { memset( ptr, ARENA_INUSE_FILLER, size ); -#ifdef VALGRIND_MAKE_WRITABLE +#if defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_DISCARD( VALGRIND_MAKE_MEM_UNDEFINED( ptr, size )); +#elif defined(VALGRIND_MAKE_WRITABLE) /* make it uninitialized to valgrind again */ VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size )); #endif diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 993936ef428..f70544de718 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -936,7 +936,9 @@ static EXCEPTION_RECORD *setup_exception( SIGCONTEXT *sigcontext, raise_func fun } stack--; /* push the stack_layout structure */ -#ifdef HAVE_VALGRIND_MEMCHECK_H +#if defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_MAKE_MEM_UNDEFINED(stack, sizeof(*stack)); +#elif defined(VALGRIND_MAKE_WRITABLE) VALGRIND_MAKE_WRITABLE(stack, sizeof(*stack)); #endif stack->ret_addr = (void *)0xdeadbabe; /* raise_func must not return */ diff --git a/loader/kthread.c b/loader/kthread.c index 2b64e27b436..efffd99f32a 100644 --- a/loader/kthread.c +++ b/loader/kthread.c @@ -150,7 +150,7 @@ static inline void writejump( const char *symbol, void *dest ) *(int *)(addr+1) = (unsigned char *)dest - (addr + 5); mprotect((void*)((unsigned int)addr & ~(getpagesize()-1)), 5, PROT_READ|PROT_EXEC); -# ifdef HAVE_VALGRIND_MEMCHECK_H +# ifdef VALGRIND_DISCARD_TRANSLATIONS VALGRIND_DISCARD_TRANSLATIONS( addr, 5 ); # endif #endif /* __GLIBC__ && __i386__ */