|
From: <sv...@va...> - 2005-09-23 03:13:59
|
Author: sewardj
Date: 2005-09-23 04:13:50 +0100 (Fri, 23 Sep 2005)
New Revision: 4728
Log:
Fix obscure bug in the sys_shmat wrapper that the sync checker picked
up. Add explaination to syswrap-main.c.
Modified:
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-23 01:=
25:38 UTC (rev 4727)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-23 03:=
13:50 UTC (rev 4728)
@@ -1621,9 +1621,6 @@
UInt segmentSize =3D get_shm_size ( arg0 );
if ( segmentSize > 0 ) {
UInt prot =3D VKI_PROT_READ|VKI_PROT_WRITE;
- /* we don't distinguish whether it's read-only or
- * read-write -- it doesn't matter really. */
- VG_TRACK( new_mem_mmap, res, segmentSize, True, True, False );
=20
if (!(arg2 & 010000)) /* =3D SHM_RDONLY */
prot &=3D ~VKI_PROT_WRITE;
@@ -1639,6 +1636,10 @@
the dev/ino. */
VG_(am_notify_client_mmap)( res, VG_PGROUNDUP(segmentSize),=20
prot, VKI_MAP_ANONYMOUS, 0,0);
+
+ /* we don't distinguish whether it's read-only or
+ * read-write -- it doesn't matter really. */
+ VG_TRACK( new_mem_mmap, res, segmentSize, True, True, False );
}
}
=20
@@ -1659,8 +1660,8 @@
if (s !=3D NULL /* && (s->flags & SF_SHM) */
/* && Implied by defn of am_find_nsegment:
VG_(seg_contains)(s, arg0, 1) */) {
+ VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
- VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
}
}
/* ------ */
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c 2005-09-23 01:25:=
38 UTC (rev 4727)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-main.c 2005-09-23 03:13:=
50 UTC (rev 4728)
@@ -170,6 +170,28 @@
build signal frames). Do not do this. If you want a signal poll
after the syscall goes through, do "*flags |=3D SfPollAfter" and the
driver logic will do it for you.
+
+ -----------
+
+ Another critical requirement following introduction of new address
+ space manager (JRS, 20050923):
+
+ In a situation where the mappedness of memory has changed, aspacem
+ should be notified BEFORE the tool. Hence the following is
+ correct:
+
+ VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
+ VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
+
+ whilst this is wrong:
+
+ VG_TRACK( die_mem_munmap, s->start, s->end+1 - s->start );
+ VG_(am_notify_munmap)(s->start, s->end+1 - s->start);
+
+ The reason is that the tool may itself ask aspacem for more shadow
+ memory as a result of the VG_TRACK call. In such a situation it is
+ critical that aspacem's segment array is up to date -- hence the
+ need to notify aspacem first.
*/
=20
=20
|