[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: Valgrind and structs with holes
From: "Dan Kegel" <dank () kegel ! com>
Date: 2007-10-31 22:59:48
Message-ID: a71bd89a0710311559g4d5b4fecl3b720472bd4c1795 () mail ! gmail ! com
[Download RAW message or body]
Valgrind is a great tool, but if there's a struct with a hole in
it, and we write that struct to a socket (say, to send it to the
server), valgrind will likely complain that the hole is uninitialized.
For instance, the warning
==3415== Syscall param writev(vector[1]) points to uninitialised byte(s)
==3415== at 0x40007F2: (within /lib/ld-2.6.1.so)
==3415== by 0x4412E24: wine_server_call (server.c:244)
==3415== by 0x43EBA73: server_ioctl_file (file.c:1010)
==3415== by 0x43EC570: NtFsControlFile (file.c:1223)
==3415== by 0x45394C1: WaitNamedPipeW (sync.c:1298)
==3415== by 0x453963B: WaitNamedPipeA (sync.c:1225)
==3415== by 0x46490B5: test_CreateNamedPipe (pipe.c:97)
in kernel32/tests/sync.c can be silenced either by appeasing Valgrind
with a patch like
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -1285,6 +1285,12 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
return FALSE;
}
+ /* FILE_PIPE_WAIT_FOR_BUFFER has a hole after boolean TimeoutSpecified.
+ * Clear the hole so valgrind doesn't get upset about uninitialized bytes.
+ * No need to zero Name[1...], which is initialized ok later.
+ */
+ memset(pipe_wait, 0, sizeof(FILE_PIPE_WAIT_FOR_BUFFER));
or by using a suppression like
{
wine_struct_hole_FILE_PIPE_WAIT_FOR_BUFFER
Memcheck:Param
writev(vector[1])
obj:*
fun:wine_server_call
fun:server_ioctl_file
fun:NtFsControlFile
fun:WaitNamedPipeW
}
Alexandre, which approach would you prefer? If you say #1, I'll eat my hat.
- Dan
--
Wine for Windows ISVs: http://kegel.com/wine/isv
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic