|
From: Tom H. <to...@co...> - 2005-07-18 15:23:07
|
There are some system calls which take pointers to structures as arguments where the structures have padding on 64 bit systems that they didn't have on 32 bit systems due to pointers within the structures increasing in size. Currently valgrind sometimes reports errors from these system calls if the client program has simply filled in all the fields in the structure rather than using memset to initialise it before filling in the fields. Typical examples of this are sendmsg and recvmsg. I've also seen it with some of the SIOGxxx ioctls. I think that where this problem arises we should probably change valgrind to check the structure members individually rather than checking the whole structure so that any padding is ignored. Does anybody have a problem with this before I start doing it? Tom -- Tom Hughes (to...@co...) http://www.compton.nu/ |
|
From: Nicholas N. <nj...@cs...> - 2005-07-18 15:30:31
|
On Mon, 18 Jul 2005, Tom Hughes wrote: > There are some system calls which take pointers to structures as > arguments where the structures have padding on 64 bit systems that > they didn't have on 32 bit systems due to pointers within the > structures increasing in size. > > Currently valgrind sometimes reports errors from these system calls > if the client program has simply filled in all the fields in the > structure rather than using memset to initialise it before filling > in the fields. > > Typical examples of this are sendmsg and recvmsg. I've also seen it > with some of the SIOGxxx ioctls. > > I think that where this problem arises we should probably change > valgrind to check the structure members individually rather than > checking the whole structure so that any padding is ignored. Does > anybody have a problem with this before I start doing it? Sounds like a necessary evil... N |
|
From: Dirk M. <dm...@gm...> - 2005-07-18 16:28:18
|
On Monday 18 July 2005 17:22, Tom Hughes wrote: > I think that where this problem arises we should probably change > valgrind to check the structure members individually rather than > checking the whole structure so that any padding is ignored. Does > anybody have a problem with this before I start doing it? Performance loss? Perhaps it would be worth only doing the opposite, ignoring of padding bytes? Dirk |
|
From: Tom H. <to...@co...> - 2005-07-18 16:35:49
|
In message <200...@gm...>
Dirk Mueller <dm...@gm...> wrote:
> On Monday 18 July 2005 17:22, Tom Hughes wrote:
>
> > I think that where this problem arises we should probably change
> > valgrind to check the structure members individually rather than
> > checking the whole structure so that any padding is ignored. Does
> > anybody have a problem with this before I start doing it?
>
> Performance loss? Perhaps it would be worth only doing the opposite, ignoring
> of padding bytes?
How? To start with there's no way to know where there are padding bytes
and even if there was the relevant memcheck entry points don't provide
for a list of regions not to check. Even if it did it would probably be
just as much of a slow down as just calling memcheck for each member.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|