|
From: Mads K. <MK...@ma...> - 2005-10-03 15:38:48
|
> > A shmget is followed by shmat called with a NULL shmaddr, but strace tells > > that NULL is changed to somethingelse (e.g. 0x1c2d2000) when using > > Memcheck, and that causes the shmat call to return EINVAL: > > > > shmget(1660995167, 0, 0660) = 1081377 > > shmctl(1081377, IPC_STAT, 0xb0f1fdfc) = 0 > > shmat(1081377, 0x1c2d2000, SHM_RDONLY) = -1 EINVAL (Invalid argument) > > Hmm. That's not good. > > Since 3.0.X, the way V handles address space, including shmat, has been > completely overhauled. It would be really helpful if you could > check out and build the latest sources and test to see if they work > for you. Without valgrind on the FIRST shmat call: shmget(1660995167, 0, 0660) = 1081377 shmat(1081377, 0, SHM_RDONLY) = 0xb6717000 shmdt(0xb6717000) = 0 shmget(1879098975, 0, 0660) = 1114146 shmat(1114146, 0, SHM_RDONLY) = 0xb6711000 shmdt(0xb6711000) = 0 3.0.1 gave shmget(1660995167, 0, 0660) = 1081377 shmctl(1081377, IPC_STAT, 0xb0f1fdfc) = 0 shmat(1081377, 0x1c2d1000, SHM_RDONLY) = 0x1c2d1000 shmctl(1081377, IPC_STAT, 0xb0f1fd88) = 0 shmdt(0x1c2d1000) = 0 shmget(1879098975, 0, 0660) = 1114146 shmctl(1114146, IPC_STAT, 0xb0f1fdfc) = 0 shmat(1114146, 0x1c2d1000, SHM_RDONLY) = 0x1c2d1000 shmctl(1114146, IPC_STAT, 0xb0f1fd88) = 0 shmdt(0x1c2d1000) = 0 - and continued until it failed as described previously. Trunk seems to assign the "NULL" an address from another range - and fails on this first occurrence: shmget(1660995167, 0, 0660) = 1081377 shmctl(1081377, IPC_STAT, 0x6471bde4) = 0 shmat(1081377, 0x49ed000, SHM_RDONLY) = 0x49ed000 shmctl(1081377, IPC_STAT, 0x6471bd6c) = 0 shmdt(0x49ed000) = 0 shmget(1879098975, 0, 0660) = 1114146 shmctl(1114146, IPC_STAT, 0x6471bde4) = 0 shmat(1114146, 0x49eb000, SHM_RDONLY) = -1 EINVAL (Invalid argument) I don't know what is going on. Any suggestions? > It's easy, if you have Subversion installed: > > svn co svn://svn.valgrind.org/valgrind/trunk > cd trunk > ./autogen.sh > ./configure --prefix=... > make install > > J Actually it wasn't easy for a subversion newbie behind a firewall. I found out how to use svn co http://svn.valgrind.org/valgrind/trunk but the VEX directory seems to be hardcoded to use svn:??? A note regarding this on http://www.valgrind.org/devel/cvs_svn.html would be helpful! ;-) Regards, Mads -----Original Message----- From: Mads Kiilerich Sent: 30. september 2005 17:00 To: 'val...@li...' Subject: shmat with NULL shmaddr causes EINVAL On a Xeon RHEL3 system I'm valgrinding a 120 Mb unstripped binary. A shmget is followed by shmat called with a NULL shmaddr, but strace tells that NULL is changed to somethingelse (e.g. 0x1c2d2000) when using Memcheck, and that causes the shmat call to return EINVAL: shmget(1660995167, 0, 0660) = 1081377 shmctl(1081377, IPC_STAT, 0xb0f1fdfc) = 0 shmat(1081377, 0x1c2d2000, SHM_RDONLY) = -1 EINVAL (Invalid argument) I can see from valgrinds source that 0 is replaced with something find_map_space-d. It works with 2.4.0, but fails in 3.0.0 and 3.0.1... http://thread.gmane.org/gmane.comp.debugging.valgrind/2213 - but valgrind came up with the address itself... http://thread.gmane.org/gmane.comp.debugging.valgrind/1042 - but addrcheck currently doesn't work... Is it because my binary+valgrind uses too much memory, and that is reported this way? Or is it a bug? Any hints how it can be debugged? Regards, Mads |
|
From: Julian S. <ju...@va...> - 2005-10-03 16:55:52
|
> Trunk seems to assign the "NULL" an address from another range > - and fails on this first occurrence: [...] I definitely want to make shm stuff work right, but I only have a hazy understanding of it. Is it possible you could create a simple test program which shows the problem? J |
|
From: Tom H. <to...@co...> - 2005-10-03 18:29:08
|
In message <E88...@ma...>
Mads Kiilerich <MK...@ma...> wrote:
> Trunk seems to assign the "NULL" an address from another range
> - and fails on this first occurrence:
>
> shmget(1660995167, 0, 0660) = 1081377
> shmctl(1081377, IPC_STAT, 0x6471bde4) = 0
> shmat(1081377, 0x49ed000, SHM_RDONLY) = 0x49ed000
> shmctl(1081377, IPC_STAT, 0x6471bd6c) = 0
> shmdt(0x49ed000) = 0
> shmget(1879098975, 0, 0660) = 1114146
> shmctl(1114146, IPC_STAT, 0x6471bde4) = 0
> shmat(1114146, 0x49eb000, SHM_RDONLY) = -1 EINVAL (Invalid argument)
>
> I don't know what is going on. Any suggestions?
One obvious cause for this would be valgrind thinking that address
is available when it isn't, although on the face of it from that
strace output it should be available.
Try running with --sanity-level=3 and see what happens - that should
help to check that the kernel memory map and valgrind's memory map are
staying in sync correctly.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Tom H. <to...@co...> - 2005-10-04 16:03:42
|
In message <a27...@lo...>
Tom Hughes <to...@co...> wrote:
> In message <E88...@ma...>
> Mads Kiilerich <MK...@ma...> wrote:
>
>> Trunk seems to assign the "NULL" an address from another range
>> - and fails on this first occurrence:
>>
>> shmget(1660995167, 0, 0660) = 1081377
>> shmctl(1081377, IPC_STAT, 0x6471bde4) = 0
>> shmat(1081377, 0x49ed000, SHM_RDONLY) = 0x49ed000
>> shmctl(1081377, IPC_STAT, 0x6471bd6c) = 0
>> shmdt(0x49ed000) = 0
>> shmget(1879098975, 0, 0660) = 1114146
>> shmctl(1114146, IPC_STAT, 0x6471bde4) = 0
>> shmat(1114146, 0x49eb000, SHM_RDONLY) = -1 EINVAL (Invalid argument)
>>
>> I don't know what is going on. Any suggestions?
>
> One obvious cause for this would be valgrind thinking that address
> is available when it isn't, although on the face of it from that
> strace output it should be available.
I have tracked down a possible cause for this, and the fix has been
committed so if you could try SVN again (revision 4854 or later) then
that would be helpful.
> Try running with --sanity-level=3 and see what happens - that should
> help to check that the kernel memory map and valgrind's memory map are
> staying in sync correctly.
This is still good advice if you find that you are still having a
problem with the latest code.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|