Subject: kern/19070: incomplete trace_enter()/ktrsyscall() number of args changes
To: None <gnats-bugs@gnats.netbsd.org>
From: None <naoki@fukaumi.org>
List: netbsd-bugs
Date: 11/16/2002 14:46:30
>Number:         19070
>Category:       kern
>Synopsis:       incomplete trace_enter()/ktrsyscall() number of args changes
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 15 21:47:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 1.6K
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD nforce.naobsd.org 1.6K NetBSD 1.6K (NFORCE) #0: Fri Nov 15 11:27:16 JST 2002 fun@nforce.naobsd.org:/usr/obj/i386/sys/arch/i386/compile/NFORCE i386
Architecture: i386
Machine: i386
>Description:
	Todays -current source build failed at sys/lkm/compat/freebsd.

/home/t/i386/bin/i386--netbsdelf-gcc -O2 -ffreestanding  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized  -Werror  -Demul_find=freebsd_emul_find				 -Dstackgap_init=freebsd_stackgap_init			 -Demul_flags_translate=freebsd_emul_flags_translate	 -Dstackgap_alloc=freebsd_stackgap_alloc		 	 -Dcompat_offseterr=freebsd_compat_offseterr -DSYSVSEM -DSYSVMSG -DSYSVSHM -DCOMPAT_FREEBSD -DKTRACE -nostdinc -nostdinc -I. -I/usr/src/sys/lkm/compat/freebsd -isystem /usr/src/sys -isystem /usr/src/sys/arch -D_KERNEL -D_LKM  -c /usr/src/sys/arch/i386/i386/freebsd_syscall.c
cc1: warnings being treated as errors
/usr/src/sys/arch/i386/i386/freebsd_syscall.c: In function `freebsd_syscall_fancy':
/usr/src/sys/arch/i386/i386/freebsd_syscall.c:234: warning: passing arg 3 of `trace_enter' makes pointer from integer without a cast
/usr/src/sys/arch/i386/i386/freebsd_syscall.c:234: too many arguments to function `trace_enter'
*** Error code 1

Stop.
nbmake: stopped in /usr/src/sys/lkm/compat/freebsd


	  http://mail-index.netbsd.org/source-changes/2002/11/15/0055.html

	This is incomplete, isn't it?

>How-To-Repeat:
	make snapshot

>Fix:
	I found they are unchanged.
	(sorry. I'm not kernel hacker. I don't know this is right)

Index: sys/arch/arm/arm/syscall.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm/arm/syscall.c,v
retrieving revision 1.12
diff -u -r1.12 syscall.c
--- sys/arch/arm/arm/syscall.c	2002/10/05 13:57:11	1.12
+++ sys/arch/arm/arm/syscall.c	2002/11/16 05:41:45
@@ -251,7 +251,7 @@
 		args = copyargs;
 	}
 
-	if ((error = trace_enter(p, code, args, rval)) != 0)
+	if ((error = trace_enter(p, code, code, args, rval)) != 0)
 		goto bad;
 
 	rval[0] = 0;
Index: sys/arch/i386/i386/syscall.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/syscall.c,v
retrieving revision 1.14
diff -u -r1.14 syscall.c
--- sys/arch/i386/i386/syscall.c	2002/10/01 12:57:01	1.14
+++ sys/arch/i386/i386/syscall.c	2002/11/16 05:41:47
@@ -231,7 +231,7 @@
 	}
 
 	KERNEL_PROC_LOCK(p);
-	if ((error = trace_enter(p, code, args, rval)) != 0)
+	if ((error = trace_enter(p, code, code, args, rval)) != 0)
 		goto bad;
 
 	rval[0] = 0;
Index: sys/arch/sparc64/sparc64/trap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/sparc64/trap.c,v
retrieving revision 1.84
diff -u -r1.84 trap.c
--- sys/arch/sparc64/sparc64/trap.c	2002/09/29 04:12:03	1.84
+++ sys/arch/sparc64/sparc64/trap.c	2002/11/16 05:41:50
@@ -1885,7 +1885,7 @@
 		
 #ifdef KTRACE
 		if (KTRPOINT(p, KTR_SYSCALL))
-			ktrsyscall(p, code, (register_t *)args.l);
+			ktrsyscall(p, code, code, (register_t *)args.l);
 #endif
 		if (error)
 			goto bad;
@@ -1958,9 +1958,9 @@
 			i = callp->sy_narg;
 			for (j = 0; j < i; j++) 
 				temp[j] = args.i[j];
-			ktrsyscall(p, code, (register_t *)temp);
+			ktrsyscall(p, code, code, (register_t *)temp);
 #else
-			ktrsyscall(p, code, (register_t *)&args.i);
+			ktrsyscall(p, code, code, (register_t *)&args.i);
 #endif
 		}
 #endif /* KTRACE */
Index: sys/arch/vax/vax/trap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/vax/vax/trap.c,v
retrieving revision 1.73
diff -u -r1.73 trap.c
--- sys/arch/vax/vax/trap.c	2002/09/29 16:49:45	1.73
+++ sys/arch/vax/vax/trap.c	2002/11/16 05:41:50
@@ -401,7 +401,7 @@
 			goto bad;
 	}
 
-	if ((err = trace_enter(p, frame->code, args, rval)) != 0)
+	if ((err = trace_enter(p, frame->code, frame->code, args, rval)) != 0)
 		goto bad;
 
 	err = (*callp->sy_call)(curproc, args, rval);
Index: sys/compat/hpux/hpux_net.c
===================================================================
RCS file: /cvsroot/syssrc/sys/compat/hpux/hpux_net.c,v
retrieving revision 1.23
diff -u -r1.23 hpux_net.c
--- sys/compat/hpux/hpux_net.c	2002/06/21 05:48:06	1.23
+++ sys/compat/hpux/hpux_net.c	2002/11/16 05:41:51
@@ -165,13 +165,15 @@
 	    (error = copyin((caddr_t)args, (caddr_t)uap, (u_int)i))) {
 #ifdef KTRACE
 		if (KTRPOINT(p, KTR_SYSCALL))
-			ktrsyscall(p, code + MINBSDIPCCODE, (register_t *)uap);
+			ktrsyscall(p, code + MINBSDIPCCODE,
+			    code + MINBSDIPCCODE, (register_t *)uap);
 #endif
 		return (error);
 	}
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSCALL))
-		ktrsyscall(p, code + MINBSDIPCCODE, (register_t *)uap);
+		ktrsyscall(p, code + MINBSDIPCCODE,
+		    code + MINBSDIPCCODE, (register_t *)uap);
 #endif
 	return ((*hpuxtobsdipc[code].rout)(p, uap, retval));
 }
Index: sys/kern/kern_subr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/kern_subr.c,v
retrieving revision 1.92
diff -u -r1.92 kern_subr.c
--- sys/kern/kern_subr.c	2002/11/11 10:43:54	1.92
+++ sys/kern/kern_subr.c	2002/11/16 05:41:53
@@ -1235,7 +1235,8 @@
  * system call number range for emulation the process runs under.
  */
 int
-trace_enter(struct proc *p, register_t code, void *args, register_t rval[])
+trace_enter(struct proc *p, register_t code,
+	register_t realcode, void *args, register_t rval[])
 {
 #ifdef SYSCALL_DEBUG
 	scdebug_call(p, code, args);
@@ -1243,7 +1244,7 @@
 
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSCALL))
-		ktrsyscall(p, code, args);
+		ktrsyscall(p, code, realcode, args);
 #endif /* KTRACE */
 
 #ifdef SYSTRACE
Index: sys/sys/ktrace.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/ktrace.h,v
retrieving revision 1.23
diff -u -r1.23 ktrace.h
--- sys/sys/ktrace.h	2002/06/17 16:23:58	1.23
+++ sys/sys/ktrace.h	2002/11/16 05:41:53
@@ -189,7 +189,7 @@
 void ktrgenio __P((struct proc *, int, enum uio_rw, struct iovec *, int, int));
 void ktrnamei __P((struct proc *, char *));
 void ktrpsig __P((struct proc *, int, sig_t, sigset_t *, int));
-void ktrsyscall __P((struct proc *, register_t, register_t []));
+void ktrsyscall __P((struct proc *, register_t, register_t, register_t []));
 void ktrsysret __P((struct proc *, register_t, int, register_t));
 void ktruser __P((struct proc *, const char *, void *, size_t, int));
 void ktrderef __P((struct proc *));
Index: sys/sys/systm.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/systm.h,v
retrieving revision 1.151
diff -u -r1.151 systm.h
--- sys/sys/systm.h	2002/09/13 14:16:48	1.151
+++ sys/sys/systm.h	2002/11/16 05:41:54
@@ -314,7 +314,8 @@
 /*
  * kernel syscall tracing/debugging hooks.
  */
-int	trace_enter __P((struct proc *, register_t, void *, register_t []));
+int	trace_enter __P((struct proc *, register_t, register_t,
+	    void *, register_t []));
 void	trace_exit __P((struct proc *, register_t, void *, register_t [], int));
 
 int	uiomove __P((void *, size_t, struct uio *));
>Release-Note:
>Audit-Trail:
>Unformatted: