Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-16 Thread Adishesh M
Hi Philippe,

After applying patch shmat is working fine.

Does this patch will be included in the next valgrind release?


Thanks and regards,
Adishesh


On Wed, Aug 15, 2012 at 11:17 PM, Adishesh  M adishes...@gmail.com wrote:
 Hi,

 i will test using patch and update the test results soon.

 Since previous mail  was mangled, resending it.

 I have used below program for testing. Below are the steps I have followed.
 Compile: gcc -g3 test_shm.c -o test_shm
 Create shared memory: ./test_shm –c
 Get shared memory without valgrind: ./test_shm –g ( this works fine)
 Get with valgrind: /usr/bin/valgrind --tool=memcheck --leak-check=full
 --track-origins=yes --log-file=/tmp/val_log /home/rtp99/test_shm –g
 With valgrind shmat command fails.

 Total shared memory segments active on the my system is 320.
 My process will attach to 40 shared memory segments. Shmat will fails
 when tested with 14 shared memory attach also.
 Total RAM available on my system is 124GB. I am using HP C7000 blade
 hardware with RHEL6.2 OS.
 I am using 64bit binary. 'file test_shm' command output is
 test_shm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
 dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not
 stripped

 Thanks and regards,
 Adishesh



Can you try again after applying the attached patch ?

Thanks

Philippe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-16 Thread Philippe Waroquiers
On Thu, 2012-08-16 at 12:51 +0530, Adishesh M wrote:
 Hi Philippe,
 
 After applying patch shmat is working fine.
 
 Does this patch will be included in the next valgrind release?
Patch has been committed (revision 12874), so will be in next release.

Philippe



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-15 Thread Adishesh M
Hi,

i will test using patch and update the test results soon.

Since previous mail  was mangled, resending it.

I have used below program for testing. Below are the steps I have followed.
Compile: gcc -g3 test_shm.c -o test_shm
Create shared memory: ./test_shm –c
Get shared memory without valgrind: ./test_shm –g ( this works fine)
Get with valgrind: /usr/bin/valgrind --tool=memcheck --leak-check=full
--track-origins=yes --log-file=/tmp/val_log /home/rtp99/test_shm –g
With valgrind shmat command fails.

Total shared memory segments active on the my system is 320.
My process will attach to 40 shared memory segments. Shmat will fails
when tested with 14 shared memory attach also.
Total RAM available on my system is 124GB. I am using HP C7000 blade
hardware with RHEL6.2 OS.
I am using 64bit binary. 'file test_shm' command output is
test_shm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not
stripped

Thanks and regards,
Adishesh

#include sys/types.h
#include sys/ipc.h
#include sys/shm.h
#include stdio.h
#include unistd.h

struct shm_details
{
 key_t key;
 size_t size;
 int shmid;
 void *shm;
};


main(int argc,char **argv)
{
  int i;
  struct shm_details test_shm[] =
  {
{0xe300626d,2147456,-1,NULL  },
{0xe300626c ,144271608  ,-1,NULL},
{0xe300626e,115604 ,-1,NULL},
{0xe300626f ,118376704 ,-1,NULL},
{0xe300653d ,574592 ,-1,NULL},
{0xe300653c ,22578504   ,-1,NULL},
{0xe300653e ,18092  ,-1,NULL},
{0xe300653f ,208416960  ,-1,NULL},
{0xe30066b9 ,2147456,-1,NULL},
{0xe30066b8 ,120870984  ,-1,NULL},
{0xe30066ba ,484260 ,-1,NULL},
{0xe30066bb ,9793648960 ,-1,NULL},
{0xe30068ad ,8438912,-1,NULL },
{0xe30068ac,553973472,-1,NULL}
};

int list = (sizeof(test_shm)/sizeof(test_shm[0]));
int shmflg;
int delete=0;
struct shmid_ds buf;

if(argc != 2)
{
  printf(Usage: ./test_shm -c|-g|-d\n -c for create shared memory\n
-g for get shared memory\n -d delete the shared memory\n);
  return(0);
}

if(strcmp(argv[1],-c) == 0)
{
 shmflg = IPC_CREAT | 0666;
}else if(strcmp(argv[1],-g) == 0)
{
  shmflg = 0666;
}else if(strcmp(argv[1],-d) == 0)
{
 shmflg = 0666;
 delete = 1;
}else{
 printf(Usage: ./test_shm -c|-g|-d\n -c for create\n -g for get
shared memory\n -d delete the shared memory\n);
 return(0);
}

for (i=0;ilist;i++)
{

 if ((test_shm[i].shmid = shmget(test_shm[i].key,
test_shm[i].size,shmflg))  0)
 {
perror(shmget);
printf(ERROR: shmget failed for shmkey=0x%x\n, test_shm[i].key);
return(1);
 }  
}

/*delete*/
if(delete == 1)
{
  for (i=0;ilist;i++)
 {
   if(shmctl(test_shm[i].shmid, IPC_RMID, buf) != 0){
  perror(shmctl);
  printf(ERROR: shmctl failed for shmkey=0x%x\n, test_shm[i].key);
  return(1);
   }
 }
 printf(INFO: All shared memories are deleted\n);
 return(0);
}

/* Now we attach the segment to our data space. */
for (i=0;ilist;i++)
{
 if((test_shm[i].shm = shmat(test_shm[i].shmid, 0, 0)) == (char *) -1){
   perror(shmat);
   printf(ERROR: shmat failed for shmkey=0x%x\n, test_shm[i].key);
   return(1);
 }
}

for (i=0;ilist;i++)
{

 if(shmdt(test_shm[i].shm) !=0 ) {
  perror(shmat);
  printf(ERROR: shmdt failed for shmkey=0x%x\n, test_shm[i].key);
  return(1);
 }
}

printf(INFO: exit success\n);
return(0);

}

Can you try again after applying the attached patch ?

Thanks

Philippe

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-14 Thread Adishesh
Hi,



I have used below program  for testing. Below are the steps I have followed.

Compile: gcc -g3 test_shm.c -o test_shm

Create shared memory: ./test_shm –c

Get shared memory without valgrind: ./test_shm –g  ( this works fine)

Get with valgrind: /usr/bin/valgrind --tool=memcheck --leak-check=full 
--track-origins=yes --log-file=/tmp/val_log /home/rtp99/test_shm –g

With valgrind shmat command fails.





Total shared memory segments  active on the my system is 320.

My process will attach to 40 shared memory segments.  Shmat will fails when 
tested with 14 shared memory attach also.

Total RAM available on my system is 124GB. I am using HP C7000 blade hardware 
with RHEL6.2 OS.

I am using 64bit binary. 'file test_shm' command output is

test_shm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically 
linked (uses shared libs), for GNU/Linux 2.6.18, not stripped



#include  

#include  

#include  

#include 

#include 





struct shm_details

{

key_t key;

size_t size;

int shmid;

void *shm;



};



main(int argc,char **argv) { 



int i;

struct shm_details test_shm[] = 

{

{0xe300626d,2147456,-1,NULL  },

{0xe300626c ,144271608  ,-1,NULL},

{0xe300626e,115604 ,-1,NULL},

{0xe300626f ,118376704 ,-1,NULL},

{0xe300653d ,574592 ,-1,NULL},

{0xe300653c ,22578504   ,-1,NULL},

{0xe300653e ,18092  ,-1,NULL},

{0xe300653f ,208416960  ,-1,NULL},

{0xe30066b9 ,2147456,-1,NULL},

{0xe30066b8 ,120870984  ,-1,NULL},

{0xe30066ba ,484260 ,-1,NULL},

{0xe30066bb ,9793648960 ,-1,NULL},

{0xe30068ad ,8438912,-1,NULL },

{0xe30068ac,553973472,-1,NULL}

};



int list = (sizeof(test_shm)/sizeof(test_shm[0]));

int shmflg;

int delete=0;

 struct shmid_ds buf;

if(argc != 2)

{

printf(Usage: ./test_shm -c|-g|-d\n -c for create shared 
memory\n -g for get shared memory\n -d delete the shared memory\n);

return(0);



}

if(strcmp(argv[1],-c) == 0)

{

shmflg = IPC_CREAT | 0666;

}else if(strcmp(argv[1],-g) == 0)

{

shmflg = 0666;

}else if(strcmp(argv[1],-d) == 0)

{

shmflg = 0666;

delete = 1;

}else{



printf(Usage: ./test_shm -c|-g|-d\n -c for create\n -g for get 
shared memory\n -d delete the shared memory\n);

return(0);

}

for (i=0;i 'uname -a' output is



 Linux mercury05 2.6.32-220.17.1.el6.x86_64 #1 SMP Thu Apr 26 13:37:13 EDT 
 2012 x86_64 x86_64 x86_64 GNU/Linux



 



 using valgrind version 3.8.0 also shmat is failing with errno 22.







Thank you for that information. Is the process running in native 64-bit mode,



or is this a 32-bit [only] process whose environment is being emulated



by the x86_64 system?







Now, please try to construct a small test case which fails in the same way:



The test app calls shmat() and works without valgrind, but gets EINVAL



when run under valgrind-3.8.0. Post the actual code to this mailing list;



the code should be no more than a few dozen lines.







Here are some situations which might affect the results:







 How many shared memory segments are attached by the app,



 and how many other shared memory segments are active



 at the same time in the whole system?







 What is the mix of access permissions (ReadOnly, ReadWrite, ...)?







 Were the shared memory segments created by the same process,



 or did the segments exist already before the process began?







 Is each shared memory segment being attached only once



 by any particular process, or are there multiple mappings?







 Is there any case which succeeds when (0!=shmaddr) ?



 Attach using shmat(shmid, 0, 0); Remember the address;



 Detach the segment; try to re-attach using shmat(shmid, old_addr, 0)



 where old_addr is the address which was returned for the first



 (successful) attach.







-- 









--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net

Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-14 Thread John Reiser
The code was mangled by posting in HTML.  Instead, use plain text (or an 
attachment,
if the mailing list allows them.)  I [attempt to] attach the code I used:
   -rw-rw-r--. 1 jreiser jreiser 3125 Aug 14 09:30 shmtest.c

On my system, /usr/include/linux/shm.h says:
-
#define SHMMAX 0x200 /* max shared seg size (bytes) */
#define SHMMIN 1 /* min shared seg size (bytes) */
#define SHMMNI 4096  /* max num of segs system wide */
#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
#define SHMSEG SHMMNI/* max shared segs per process */
-
In particular, SHMMAX is only 32MiB, so several of the attempted shared segments
are too big.  My current actual parameters in
   $ cat /proc/sys/kernel/shmall
   $ cat /proc/sys/kernel/shmmax
   $ cat /proc/sys/kernel/shmmni
agree with the defaults that are in shm.h.


My test program works for me under valgrind-3.8.0 on Fedora 17 x86_64 in 64-bit 
mode.
   Linux host.domain 3.5.0-2.fc17.x86_64 #1 SMP Mon Jul 30 14:48:59 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux
   gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
I [attempt to] attach the output that I get:
   -rw-rw-r--. 1 jreiser jreiser 9321 Aug 14 09:31 shmtest.out


To see the system calls that valgrind sees:
   valgrind --trace-syscalls=yes ...
Of course you can run that under strace, too, in order to verify
that valgrind actually does what it says it is doing:
   strace valgrind --trace-syscalls=yes ...
but it is tedious to read the output.

-- 


#include sys/types.h
#include sys/shm.h
#include stdio.h
#include stdlib.h

struct shm_details
{
	key_t key;
	size_t size;
	int shmid;
	void *shm;
};

main(int argc,char **argv)
{
	int i;
	/* default SHMMAX is 32MB */
	struct shm_details test_shm[] = {
		{0xe300626d,2147456, -1, NULL },
		{0xe300626c,  144271608, -1, NULL},  /* LARGE */
		{0xe300626e, 115604, -1, NULL},
		{0xe300626f,  118376704, -1, NULL},  /* LARGE */
		{0xe300653d, 574592, -1, NULL},
		{0xe300653c,   22578504, -1, NULL},
		{0xe300653e,  18092, -1, NULL},
		{0xe300653f,  208416960, -1, NULL},  /* LARGE */
		{0xe30066b9,2147456, -1, NULL},
		{0xe30066b8,  120870984, -1, NULL},  /* LARGE */
		{0xe30066ba, 484260, -1, NULL},
		{0xe30066bb, 9793648960, -1, NULL},  /* LARGE */
		{0xe30068ad,8438912, -1, NULL},
		{0xe30068ac,  553973472, -1, NULL}  /* LARGE */
	};

	int n_err = 0;
	int list = (sizeof(test_shm)/sizeof(test_shm[0]));
	int shmflg;
	int delete=0;
	if (argc != 2) {
		printf(Usage: ./test_shm -c|-g|-d\n -c for create shared memory\n -g for get shared memory\n -d delete the shared memory\n);
		return(0);
	}
	if (strcmp(argv[1],-c) == 0) {
		shmflg = IPC_CREAT | 0666;
	}else if (strcmp(argv[1],-g) == 0) {
		shmflg = 0666;
	} else if (strcmp(argv[1],-d) == 0) {
		shmflg = 0666;
		delete = 1;
	} else {
		printf(Usage: ./test_shm -c|-g|-d\n -c for create\n -g for get shared memory\n -d delete the shared memory\n);
		return(0);
	}

	n_err=0;
	for (i=0;i  sizeof(test_shm)/sizeof(test_shm[0]); ++i) {
		test_shm[i].shmid = shmget(test_shm[i].key, test_shm[i].size, shmflg);
		printf(\tid=%#8.8x = shmget(key=%#8.8x, size=%#8.8lx, flag=%#o)\n,
			test_shm[i].shmid, test_shm[i].key, test_shm[i].size, shmflg);
		if (test_shm[i].shmid == -1) {
			perror(shmget);
			printf(ERROR: shmget failed for shmkey=0x%)x\n, test_shm[i].key);
			++n_err;
		}
	}

	/*delete*/
	n_err=0;
	if (delete == 1) {
		for (i=0;i  sizeof(test_shm)/sizeof(test_shm[0]); ++i) {
			struct shmid_ds buf;
			int const r = shmctl(test_shm[i].shmid, IPC_RMID, buf);
			printf(\tr=%d = shmctl(id=%#8.8x, op=%x)\n, r, test_shm[i].shmid, IPC_RMID);
			if (r!=0) {
perror(shmctl);
printf(ERROR: shmctl failed for shmkey=0x%x)\n, test_shm[i].key);
++n_err;
			}
		}
		printf(INFO: All shared memories are deleted\n);
		return n_err;
	}

	/* Now we attach the segment to our data space. */
	n_err=0;
	for (i=0;i  sizeof(test_shm)/sizeof(test_shm[0]); ++i) {
		test_shm[i].shm = shmat(test_shm[i].shmid, 0, 0);
		printf(\t%p = shmat(key=%#8.8x, 0, 0)\n, test_shm[i].shm, test_shm[i].shmid);
		if (test_shm[i].shm == (char *) -1) {
			perror(shmat);
			printf(ERROR: shmat failed for shmkey=0x%x\n, test_shm[i].key);
			++n_err;
		}
	}

	n_err=0;
	for (i=0;i  sizeof(test_shm)/sizeof(test_shm[0]); ++i) {
		int const r = shmdt(test_shm[i].shm);
		printf(\t%#x = shmdt(addr=%p)\n, r, test_shm[i].shm);
		if (r !=0 ) {
			perror(shmat);
			printf(ERROR: shmdt failed for shmkey=0x%x\n, test_shm[i].key);
			++n_err;
		}
		return n_err;
	}

	printf(INFO: exit success\n);
	return(0);
}


$ /usr/local/valgrind-3.8.0/bin/valgrind --tool=memcheck --leak-check=full 
--track-origins=yes ./shmtest -c
==3629== Memcheck, a memory error detector
==3629== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==3629== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==3629== Command: ./shmtest -c
==3629== 
id=0x0035000e = 

Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-14 Thread Philippe Waroquiers
On Tue, 2012-08-14 at 10:20 +, Adishesh wrote:
 Hi,
 
 I have used below program for testing. Below are the steps I have
 followed.
 Compile: gcc -g3 test_shm.c -o test_shm
 Create shared memory: ./test_shm –c
 Get shared memory without valgrind: ./test_shm –g ( this works fine)
 Get with valgrind: /usr/bin/valgrind --tool=memcheck --leak-check=full
 --track-origins=yes --log-file=/tmp/val_log /home/rtp99/test_shm –g
 With valgrind shmat command fails.
Can you try again after applying the attached patch ?

Thanks

Philippe

Index: coregrind/m_syswrap/syswrap-generic.c
===
--- coregrind/m_syswrap/syswrap-generic.c   (revision 12872)
+++ coregrind/m_syswrap/syswrap-generic.c   (working copy)
@@ -1700,7 +1700,7 @@
 /* -- */
 
 static
-UInt get_shm_size ( Int shmid )
+SizeT get_shm_size ( Int shmid )
 {
 #ifdef __NR_shmctl
 #  ifdef VKI_IPC_64
@@ -1725,7 +1725,7 @@
if (sr_isError(__res))
   return 0;
  
-   return buf.shm_segsz;
+   return (SizeT) buf.shm_segsz;
 }
 
 UWord
@@ -1733,7 +1733,7 @@
  UWord arg0, UWord arg1, UWord arg2 )
 {
/* void *shmat(int shmid, const void *shmaddr, int shmflg); */
-   UInt  segmentSize = get_shm_size ( arg0 );
+   SizeT  segmentSize = get_shm_size ( arg0 );
UWord tmp;
Bool  ok;
if (arg1 == 0) {
@@ -1768,7 +1768,7 @@
   UWord res,
   UWord arg0, UWord arg1, UWord arg2 )
 {
-   UInt segmentSize = VG_PGROUNDUP(get_shm_size(arg0));
+   SizeT segmentSize = VG_PGROUNDUP(get_shm_size(arg0));
if ( segmentSize  0 ) {
   UInt prot = VKI_PROT_READ|VKI_PROT_WRITE;
   Bool d;
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


[Valgrind-users] shmat parameters are modified by valgrind

2012-08-13 Thread Adishesh
Hi,



I am a program which will do many shmat. This program when executed without 
valgrind it works as expected.



But when same program is executed under valgrind shmat parameters are getting 
modified and shmat is failing with errno 22.



without valgrind ( taken using strace command)

--

shmat(281542719, 0, 0)  = ?

shmat(281575488, 0, 0)  = ?

shmat(281608257, 0, 0)  = ?

shmat(281641026, 0, 0)  = ?

shmat(281673795, 0, 0)  = ?

shmat(281706564, 0, 0)  = ?

shmat(281739333, 0, 0)  = ?

shmat(281772102, 0, 0)  = ?

shmat(281804871, 0, 0)  = ?

shmat(282001485, 0, 0)  = ?

shmat(282034254, 0, 0)  = ?

shmat(282067023, 0, 0)  = ?

shmat(282099792, 0, 0)  = ?

shmat(282132561, 0, 0)  = ?

shmat(282329175, 0, 0)  = ?

shmat(282361944, 0, 0)  = ?

shmat(282394713, 0, 0)  = ?

shmat(282427482, 0, 0)  = ?

shmat(282460251, 0, 0)  = ?

shmat(282853479, 0, 0)  = ?

shmat(282886248, 0, 0)  = ?

shmat(282919017, 0, 0)  = ?

shmat(282951786, 0, 0)  = ?

shmat(282984555, 0, 0)  = ?

shmat(283345014, 0, 0)  = ?

shmat(283377783, 0, 0)  = ?





with valgrind ( taken using strace command)

--

shmat(281542719, 0xf1c, 0)  = ?

shmat(281575488, 0x17b57000, 0) = ?

shmat(281608257, 0x18ebf000, 0) = ?

shmat(281641026, 0x18edc000, 0) = ?

shmat(281673795, 0x1ffc1000, 0) = ?

shmat(281706564, 0x200ce000, 0) = ?

shmat(281739333, 0x24a5, 0) = ?

shmat(281772102, 0x254ae000, 0) = ?

shmat(281804871, 0x254be000, 0) = ?

shmat(282001485, 0x336e9000, 0) = ?

shmat(282034254, 0x336f7000, 0) = ?

shmat(282067023, 0x33744000, 0) = ?

shmat(282099792, 0x4219000, 0)  = ?

shmat(282132561, 0x3374f000, 0) = ?

shmat(282329175, 0x3377e000, 0) = ?

shmat(282361944, 0x3378d000, 0) = ?

shmat(282394713, 0x337fa000, 0) = ?

shmat(282427482, 0x421a000, 0)  = ?

shmat(282460251, 0x3380a000, 0) = ?

shmat(282853479, 0x345b7000, 0) = ?

shmat(282886248, 0x345c4000, 0) = ?

shmat(282919017, 0x421b000, 0)  = ?

shmat(282951786, 0x345df000, 0) = ?

shmat(282984555, 0x345e, 0) = ?

shmat(283345014, 0x3466b000, 0) = ?

shmat(283377783, 0x346f8000, 0) = ?





how to overcome this problem?

currently i am using valgrind version valgrind-3.6.0. 





Thanks and regards,

Adishesh







--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-13 Thread John Reiser
 But when same program is executed under valgrind shmat parameters are getting 
 modified and shmat is failing with errno 22.
 
 without valgrind ( taken using strace command)
 --
 shmat(281542719, 0, 0) = ?

 
 with valgrind ( taken using strace command)
 --
 shmat(281542719, 0xf1c, 0) = ?

Please tell us which hardware and operating system, and which version of 
valgrind.
It matters.  In particular, errno 22 might not be EINVAL on all systems.

The second parameter to shmat() is the preferred address, where 0 means I 
don't care
which address, just give me a good one.  In order to manage and track the 
address space,
then valgrind picks what it considers to be a good address, and asks for shmat()
at that address.

In order to get beyond errno 22, then we must determine _why_ your system
believes that the address is not valid.  The particular case of 0x0f1c
looks pretty good to me: on a 256 KB boundary, not too large, etc.
Why does your system complain?

-- 


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-13 Thread Adishesh
Hi,

I am using RHEL6.2 OS.



'uname -a' output is

Linux mercury05 2.6.32-220.17.1.el6.x86_64 #1 SMP Thu Apr 26 13:37:13 EDT 2012 
x86_64 x86_64 x86_64 GNU/Linux



using valgrind version 3.8.0 also shmat is failing with errno 22.



Thanks and regards,

Adishesh



On Mon, 13 Aug 2012 21:46:34 +0530  wrote

 But when same program is executed under valgrind shmat parameters are 
 getting modified and shmat is failing with errno 22.



 



 without valgrind ( taken using strace command)



 --



 shmat(281542719, 0, 0) = ?







 



 with valgrind ( taken using strace command)



 --



 shmat(281542719, 0xf1c, 0) = ?







Please tell us which hardware and operating system, and which version of 
valgrind.



It matters. In particular, errno 22 might not be EINVAL on all systems.







The second parameter to shmat() is the preferred address, where 0 means I 
don't care



which address, just give me a good one. In order to manage and track the 
address space,



then valgrind picks what it considers to be a good address, and asks for shmat()



at that address.







In order to get beyond errno 22, then we must determine _why_ your system



believes that the address is not valid. The particular case of 0x0f1c



looks pretty good to me: on a 256 KB boundary, not too large, etc.



Why does your system complain?







-- 











--



Live Security Virtual Conference



Exclusive live event will cover all the ways today's security and 



threat landscape has changed and how IT managers can respond. Discussions 



will include endpoint security, mobile security and the latest in malware 



threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/



___



Valgrind-users mailing list



Valgrind-users@lists.sourceforge.net



https://lists.sourceforge.net/lists/listinfo/valgrind-users



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] shmat parameters are modified by valgrind

2012-08-13 Thread John Reiser
 I am using RHEL6.2 OS.
 
 'uname -a' output is
 Linux mercury05 2.6.32-220.17.1.el6.x86_64 #1 SMP Thu Apr 26 13:37:13 EDT 
 2012 x86_64 x86_64 x86_64 GNU/Linux
 
 using valgrind version 3.8.0 also shmat is failing with errno 22.

Thank you for that information.  Is the process running in native 64-bit mode,
or is this a 32-bit [only] process whose environment is being emulated
by the x86_64 system?

Now, please try to construct a small test case which fails in the same way:
The test app calls shmat() and works without valgrind, but gets EINVAL
when run under valgrind-3.8.0.  Post the actual code to this mailing list;
the code should be no more than a few dozen lines.

Here are some situations which might affect the results:

  How many shared memory segments are attached by the app,
  and how many other shared memory segments are active
  at the same time in the whole system?

  What is the mix of access permissions (ReadOnly, ReadWrite, ...)?

  Were the shared memory segments created by the same process,
  or did the segments exist already before the process began?

  Is each shared memory segment being attached only once
  by any particular process, or are there multiple mappings?

  Is there any case which succeeds when (0!=shmaddr) ?
  Attach using shmat(shmid, 0, 0); Remember the address;
  Detach the segment; try to re-attach using shmat(shmid, old_addr, 0)
  where old_addr is the address which was returned for the first
  (successful) attach.

-- 


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users