ntdll: Ignore the hole in the FILE_PIPE_WAIT_FOR_BUFFER structure passed into NtFsControlFile before writing the structure to the server.

Rob Shearman robertshearman at gmail.com
Mon Dec 14 08:32:50 CST 2009


---
 dlls/ntdll/file.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

A fix for the same problem was discussed back in June '08 and a
solution was recommended:
http://www.winehq.org/pipermail/wine-devel/2008-June/066575.html

However, the solution of ignoring the hole category of Valgrind
warnings (i.e. matching the following pattern) is not workable:
 Syscall param writev(vector[...]) points to uninitialised byte(s)
    at  writev (writev.c:46)
    by  send_request (server.c:214)
    by  wine_server_call (server.c:295)
    by  server_ioctl_file (file.c:1236)
    by  NtFsControlFile (file.c:1450)

This is because it may hide real problems where fields in the
structures that do matter are uninitialised. We could just work around
the one specific problem by fully initialising the structure passed
into NtFsControlFile by WaitNamedPipeW, but applications could call
NtFsControlFile directly and they may still trigger a warning. We
cannot clear the holes using memset inside NtFsControlFile since the
caller may not be expecting the input buffer to be modified.
Therefore, the least intrusive solution is to tell Valgrind that the
holes in the structures are defined and this solution can be expanded
as necessary for other ioctls. It's not perfect as the state set here
persists after the NtFsControlFile call, but we're very unlikely to
affect the detection of bugs because of this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ntdll-Ignore-the-hole-in-the-FILE_PIPE_WAIT_FOR_BUFF.patch
Type: text/x-patch
Size: 1897 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20091214/d42da596/attachment.bin>


More information about the wine-patches mailing list