On 4/14/25 7:13 AM, kiran hardas wrote:
Hi Team,
I haven't received any suggestion or advice to my shmat valgrind wrapper
behaviour mentioned in previous mail.
--- a/valgrind/coregrind/m_syswrap/syswrap-generic.c
+++ b/valgrind/coregrind/m_syswrap/syswrap-generic.c
@@ -2052,7 +2052,7 @@ ML_(generic_PRE_sys_shmat) ( ThreadId tid,
{
/* void *shmat(int shmid, const void *shmaddr, int shmflg); */
SizeT segmentSize = get_shm_size ( arg0 );
- UWord tmp;
+ UWord tmp = 0;
Bool ok;
if (arg1 == 0) {
/* arm-linux only: work around the fact that
In the current git source for
valgrind/coregrind/m_syswrap/syswrap-generic.c at function
ML_(generic_PRE_sys_shmat) (line 2346), I see
=====
if (arg1 == 0) {
/* arm-linux only: work around the fact that
VG_(am_get_advisory_client_simple) produces something that is
VKI_PAGE_SIZE aligned, whereas what we want is something
VKI_SHMLBA aligned, and VKI_SHMLBA >= VKI_PAGE_SIZE. Hence
increase the request size by VKI_SHMLBA - VKI_PAGE_SIZE and
then round the result up to the next VKI_SHMLBA boundary.
See bug 222545 comment 15. So far, arm-linux is the only
platform where this is known to be necessary. */
=====
where "git blame" for the first two lines says
=====
cc8ccbbfb4 coregrind/m_syswrap/syswrap-generic.c (Julian Seward
2005-09-27 19:20:21 +0000 2346) if (arg1 == 0) {
566a25cf7e coregrind/m_syswrap/syswrap-generic.c (Julian Seward
2010-10-06 15:24:39 +0000 2347) /* arm-linux only: work around the
fact that
=====
but I do not see any guard that tests for arm-linux only. So I would
say that the current source has a bug!
Thus your change
With this change, my shmat functions calls are working fine as different
adresses are picked up for attach.
is not only OK; it should be propagated into the official source.
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users