Bug#218636: Why is this a valgrind bug?
On Sun, Nov 02, 2003 at 01:20:56PM -0500, Daniel Jacobowitz wrote:
> On Sun, Nov 02, 2003 at 01:04:26PM -0500, Andrew Moise wrote:
> > valgrind already does the right thing sometimes (though it still
> > includes a lot of kernel headers also); some kernel header info has been
> > copied into vg_kerneliface.h and is used from there. IMO the ipc stuff
> > (and some ISDN stuff that's causing problems as well) should be copied
> > there. I'd be happy to give you a patch if you like; I already prodded
> > the thing into working again on my system.
>
> Please do post the patch. I'd like to see what was necessary.
Sure thing.
diff -ur valgrind-20031012.orig/coregrind/vg_intercept.c valgrind-20031012/coregrind/vg_intercept.c
--- valgrind-20031012.orig/coregrind/vg_intercept.c 2003-11-02 13:29:31.000000000 -0500
+++ valgrind-20031012/coregrind/vg_intercept.c 2003-11-02 13:31:43.000000000 -0500
@@ -61,7 +61,6 @@
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
-#include <asm/ipc.h> /* for ipc_kludge */
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/uio.h>
@@ -430,7 +429,7 @@
{
struct vki_timespec nanosleep_interval;
int err;
- struct ipc_kludge tmp;
+ struct vki_ipc_kludge tmp;
ensure_valgrind("msgrcv");
diff -ur valgrind-20031012.orig/coregrind/vg_syscalls.c valgrind-20031012/coregrind/vg_syscalls.c
--- valgrind-20031012.orig/coregrind/vg_syscalls.c 2003-11-02 13:36:07.000000000 -0500
+++ valgrind-20031012/coregrind/vg_syscalls.c 2003-11-02 13:38:42.000000000 -0500
@@ -1808,7 +1808,7 @@
Int msgsz = arg3;
msgp = (struct msgbuf *)deref_Addr( tid,
- (Addr) (&((struct ipc_kludge *)arg5)->msgp),
+ (Addr) (&((struct vki_ipc_kludge *)arg5)->msgp),
"msgrcv(msgp)" );
SYSCALL_TRACK( pre_mem_write, tid, "msgrcv(msgp->mtype)",
@@ -2140,7 +2140,7 @@
break;
# endif
- case IIOCGETCPS:
+ case VKI_IIOCGETCPS:
/* In early 2.4 kernels, ISDN_MAX_CHANNELS was only defined
* when KERNEL was. I never saw a larger value than 64 though */
# ifndef ISDN_MAX_CHANNELS
@@ -2154,15 +2154,15 @@
VG_TRACK( post_mem_write, arg3, ISDN_MAX_CHANNELS
* 2 * sizeof(unsigned long) );
break;
- case IIOCNETGPN:
+ case VKI_IIOCNETGPN:
SYSCALL_TRACK( pre_mem_read, tid, "ioctl(IIOCNETGPN)",
- (UInt)&((isdn_net_ioctl_phone *)arg3)->name,
- sizeof(((isdn_net_ioctl_phone *)arg3)->name) );
+ (UInt)&((vki_isdn_net_ioctl_phone *)arg3)->name,
+ sizeof(((vki_isdn_net_ioctl_phone *)arg3)->name) );
SYSCALL_TRACK( pre_mem_write, tid, "ioctl(IIOCNETGPN)", arg3,
- sizeof(isdn_net_ioctl_phone) );
+ sizeof(vki_isdn_net_ioctl_phone) );
KERNEL_DO_SYSCALL(tid,res);
if (!VG_(is_kerror)(res) && res == 0)
- VG_TRACK( post_mem_write, arg3, sizeof(isdn_net_ioctl_phone) );
+ VG_TRACK( post_mem_write, arg3, sizeof(vki_isdn_net_ioctl_phone) );
break;
/* These all use struct ifreq AFAIK */
diff -ur valgrind-20031012.orig/coregrind/vg_unsafe.h valgrind-20031012/coregrind/vg_unsafe.h
--- valgrind-20031012.orig/coregrind/vg_unsafe.h 2003-11-02 13:32:57.000000000 -0500
+++ valgrind-20031012/coregrind/vg_unsafe.h 2003-11-02 13:37:09.000000000 -0500
@@ -46,11 +46,9 @@
#include <net/if.h> /* for struct ifreq et al */
#include <net/if_arp.h> /* for struct arpreq */
#include <net/route.h> /* for struct rtentry */
-#include <asm/ipc.h> /* for struct ipc_kludge */
#include <linux/msg.h> /* for struct msgbuf */
#include <linux/sem.h> /* for struct sembuf */
-#include <linux/isdn.h> /* for ISDN ioctls */
#include <scsi/sg.h> /* for the SG_* ioctls */
#include <sched.h> /* for struct sched_param */
#include <linux/sysctl.h> /* for struct __sysctl_args */
diff -ur valgrind-20031012.orig/include/vg_kerneliface.h valgrind-20031012/include/vg_kerneliface.h
--- valgrind-20031012.orig/include/vg_kerneliface.h 2003-11-02 13:26:20.000000000 -0500
+++ valgrind-20031012/include/vg_kerneliface.h 2003-11-02 13:41:37.000000000 -0500
@@ -410,7 +410,25 @@
#define VKI_MODIFY_LDT_CONTENTS_STACK 1
#define VKI_MODIFY_LDT_CONTENTS_CODE 2
+/* IPC stuff, from 2.6.0-test7 asm/ipc.h: */
+struct vki_ipc_kludge {
+ struct msgbuf *msgp;
+ long msgtyp;
+};
+
+/* ISDN stuff, from 2.6.0-test7 linux/isdn.h: */
+
+#define VKI_IIOCGETCPS _IO('I',21)
+#define VKI_IIOCNETGPN _IO('I',34)
+
+#define VKI_ISDN_MSNLEN 32
+
+typedef struct {
+ char name[10];
+ char phone[VKI_ISDN_MSNLEN];
+ int outgoing;
+} vki_isdn_net_ioctl_phone;
#endif /* ndef __VG_KERNELIFACE_H */
Reply to: