|
From: <sv...@va...> - 2005-06-24 21:42:04
|
Author: njn
Date: 2005-06-24 22:41:28 +0100 (Fri, 24 Jun 2005)
New Revision: 4014
Log:
Fix bug #107524 -- epoll_ctl does not access 'events' if it's a
EPOLL_CTL_DEL invocation.
Also renamed our "struct epoll_event" to "struct vki_epoll_event" as it
should be called.
Modified:
trunk/coregrind/m_syswrap/syswrap-linux.c
trunk/include/vki-linux.h
Modified: trunk/coregrind/m_syswrap/syswrap-linux.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
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2005-06-24 15:40:01 UTC (re=
v 4013)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2005-06-24 21:41:28 UTC (re=
v 4014)
@@ -567,8 +567,9 @@
PRINT("sys_epoll_ctl ( %d, %s, %d, %p )",=20
ARG1, ( ARG2<3 ? epoll_ctl_s[ARG2] : "?" ), ARG3, ARG4);
PRE_REG_READ4(long, "epoll_ctl",
- int, epfd, int, op, int, fd, struct epoll_event *, even=
t);
- PRE_MEM_READ( "epoll_ctl(event)", ARG4, sizeof(struct epoll_event) );
+ int, epfd, int, op, int, fd, struct vki_epoll_event *, =
event);
+ if (ARG2 !=3D VKI_EPOLL_CTL_DEL)
+ PRE_MEM_READ( "epoll_ctl(event)", ARG4, sizeof(struct vki_epoll_ev=
ent) );
}
=20
PRE(sys_epoll_wait)
@@ -576,15 +577,15 @@
*flags |=3D SfMayBlock;
PRINT("sys_epoll_wait ( %d, %p, %d, %d )", ARG1, ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "epoll_wait",
- int, epfd, struct epoll_event *, events,
+ int, epfd, struct vki_epoll_event *, events,
int, maxevents, int, timeout);
- PRE_MEM_WRITE( "epoll_wait(events)", ARG2, sizeof(struct epoll_event)=
*ARG3);
+ PRE_MEM_WRITE( "epoll_wait(events)", ARG2, sizeof(struct vki_epoll_ev=
ent)*ARG3);
}
POST(sys_epoll_wait)
{
vg_assert(SUCCESS);
if (RES > 0)
- POST_MEM_WRITE( ARG2, sizeof(struct epoll_event)*RES ) ;
+ POST_MEM_WRITE( ARG2, sizeof(struct vki_epoll_event)*RES ) ;
}
=20
PRE(sys_gettid)
Modified: trunk/include/vki-linux.h
=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
--- trunk/include/vki-linux.h 2005-06-24 15:40:01 UTC (rev 4013)
+++ trunk/include/vki-linux.h 2005-06-24 21:41:28 UTC (rev 4014)
@@ -845,16 +845,21 @@
};
=20
//----------------------------------------------------------------------
-// From linux-2.6.8.1/include/linux/eventpoll.h
+// From linux-2.6.12.1/include/linux/eventpoll.h
//----------------------------------------------------------------------
=20
+/* Valid opcodes to issue to sys_epoll_ctl() */
+#define VKI_EPOLL_CTL_ADD 1
+#define VKI_EPOLL_CTL_DEL 2
+#define VKI_EPOLL_CTL_MOD 3
+
#ifdef __x86_64__
#define VKI_EPOLL_PACKED __attribute__((packed))
#else
#define VKI_EPOLL_PACKED
#endif
=20
-struct epoll_event {
+struct vki_epoll_event {
__vki_u32 events;
__vki_u64 data;
} VKI_EPOLL_PACKED;
|