Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2009 05:11:51 +0300
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        Xin LI <delphij@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r192943 - head/usr.bin/truss
Message-ID:  <87prdu6kns.fsf@kobe.laptop>
In-Reply-To: <200905280038.n4S0cON4017067@svn.freebsd.org> (Xin LI's message of "Thu, 28 May 2009 00:38:24 %2B0000 (UTC)")
References:  <200905280038.n4S0cON4017067@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 28 May 2009 00:38:24 +0000 (UTC), Xin LI <delphij@FreeBSD.org> wrote:
> Author: delphij
> Date: Thu May 28 00:38:24 2009
> New Revision: 192943
> URL: http://svn.freebsd.org/changeset/base/192943
>
> Log:
>   Correct off-by-one issue in truss(1) which happens when system call number
>   is nsyscalls.
>
>   PR:		bin/134916
>   Submitted by:	Steven Hartland <steven hartland multiplay co uk>
>   MFC after:	2 weeks

Thank you!

I've been running with precisely the same patch locally for some time,
but didn't manage to get it tested well enough to commit it :-)

The only local diff I have now from /head is a minor change that wraps
lines that are at the same time already wrapped *and* too long.  If that
looks useful as a followup change please feel free to use it:

%%%
diff -r b88f7e077f9c usr.bin/truss/amd64-fbsd.c
--- a/usr.bin/truss/amd64-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/amd64-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -141,8 +141,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ?  NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/amd64-fbsd32.c
--- a/usr.bin/truss/amd64-fbsd32.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/amd64-fbsd32.c	Thu May 28 05:10:58 2009 +0300
@@ -151,8 +151,7 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL :
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
       freebsd32_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
diff -r b88f7e077f9c usr.bin/truss/amd64-linux32.c
--- a/usr.bin/truss/amd64-linux32.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/amd64-linux32.c	Thu May 28 05:10:58 2009 +0300
@@ -123,8 +123,8 @@
   syscall_num = regs.r_rax;
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      linux32_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/i386-fbsd.c
--- a/usr.bin/truss/i386-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/i386-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -146,8 +146,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/i386-linux.c
--- a/usr.bin/truss/i386-linux.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/i386-linux.c	Thu May 28 05:10:58 2009 +0300
@@ -123,8 +123,8 @@
   syscall_num = regs.r_eax;
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux_syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      linux_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/ia64-fbsd.c
--- a/usr.bin/truss/ia64-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/ia64-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -135,8 +135,8 @@
     syscall_num = (int)*parm_offset++;
 
   fsc.number = syscall_num;
-  fsc.name = (syscall_num < 0 || syscall_num > nsyscalls)
-      ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/powerpc-fbsd.c
--- a/usr.bin/truss/powerpc-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/powerpc-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -148,8 +148,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/sparc64-fbsd.c
--- a/usr.bin/truss/sparc64-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/sparc64-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -144,8 +144,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
%%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87prdu6kns.fsf>