|
From: Adishesh <adi...@re...> - 2012-08-13 11:40:00
|
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, 0xf1c0000, 0) = ? shmat(281575488, 0x17b57000, 0) = ? shmat(281608257, 0x18ebf000, 0) = ? shmat(281641026, 0x18edc000, 0) = ? shmat(281673795, 0x1ffc1000, 0) = ? shmat(281706564, 0x200ce000, 0) = ? shmat(281739333, 0x24a50000, 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, 0x345e0000, 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 |
|
From: John R. <jr...@bi...> - 2012-08-13 16:15:31
|
> 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, 0xf1c0000, 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 0x0f1c0000 looks pretty good to me: on a 256 KB boundary, not too large, etc. Why does your system complain? -- |