public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: frysk@sourceware.org
Subject: [patch] IA32 subsyscall list fixes
Date: Tue, 31 Jul 2007 10:50:00 -0000	[thread overview]
Message-ID: <1185879001.3653.75.camel@dijkstra.wildebeest.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 724 bytes --]

Hi,

Rick found an off by one error in the IA32 IPC subsyscall list, we
forgot to skip subcall zero. This patch fixes that and adds an extra
sanity/robustness check in case someone tries to make a socket or ipc
subsyscall with an unknown number.

2007-07-31  Mark Wielaard  <mwielaard@redhat.com>

    Fixes bug #4865
    * LinuxIa32Syscall.java (unknownIpcSubSyscall): New static field.
    (unknownSocketSubSyscall): Likewise.
    (ipcSubcallList): Add unknown numbers, including zero.
    (syscallByNum): Bounds check socketSubcallList and ipcSubcallList
    arrays before returning possible unknown subsyscall.

This makes it possible to ftrace FryskGui which is a nice stress tests.

Cheers,

Mark

[-- Attachment #1.2: LinuxIa32Syscall.patch --]
[-- Type: text/x-patch, Size: 3234 bytes --]

Index: frysk-core/frysk/proc/LinuxIa32Syscall.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/LinuxIa32Syscall.java,v
retrieving revision 1.7
diff -u -r1.7 LinuxIa32Syscall.java
--- frysk-core/frysk/proc/LinuxIa32Syscall.java	4 May 2007 18:26:54 -0000	1.7
+++ frysk-core/frysk/proc/LinuxIa32Syscall.java	31 Jul 2007 10:43:55 -0000
@@ -498,6 +498,8 @@
     new SocketSubSyscall ("recvmsg",    SOCKET_NUM, 5, "i:iiipp ")
   };
 
+  private static final SocketSubSyscall unknownSocketSubSyscall =
+    new SocketSubSyscall ("<unknown>", SOCKET_NUM);
 
   static class IpcSubSyscall
     extends Ia32Syscall
@@ -522,32 +524,36 @@
   }
   /**FIXME: No argument list here.*/
   static Syscall[] ipcSubcallList = {
+    new IpcSubSyscall ("<unknown0>",  IPC_NUM),
     new IpcSubSyscall ("semop",  IPC_NUM),
     new IpcSubSyscall ("semget", IPC_NUM),
     new IpcSubSyscall ("semctl",  IPC_NUM),
     new IpcSubSyscall ("semtimedop", IPC_NUM),
-    new IpcSubSyscall ("",  IPC_NUM),
-    new IpcSubSyscall ("", IPC_NUM),
-    new IpcSubSyscall ("",  IPC_NUM),
-    new IpcSubSyscall ("", IPC_NUM),
-    new IpcSubSyscall ("",  IPC_NUM),
-    new IpcSubSyscall ("", IPC_NUM),
+    new IpcSubSyscall ("<unknown5>",  IPC_NUM),
+    new IpcSubSyscall ("<unknown6>", IPC_NUM),
+    new IpcSubSyscall ("<unknown7>",  IPC_NUM),
+    new IpcSubSyscall ("<unknown8>", IPC_NUM),
+    new IpcSubSyscall ("<unknown9>",  IPC_NUM),
+    new IpcSubSyscall ("<unknown10>", IPC_NUM),
     new IpcSubSyscall ("msgsnd",  IPC_NUM),
     new IpcSubSyscall ("msgrcv", IPC_NUM),
     new IpcSubSyscall ("msgget",  IPC_NUM),
     new IpcSubSyscall ("msgctl", IPC_NUM),
-    new IpcSubSyscall ("",  IPC_NUM),
-    new IpcSubSyscall ("", IPC_NUM),
-    new IpcSubSyscall ("",  IPC_NUM),
-    new IpcSubSyscall ("", IPC_NUM),
-    new IpcSubSyscall ("",  IPC_NUM),
-    new IpcSubSyscall ("", IPC_NUM),
+    new IpcSubSyscall ("<unknown15>",  IPC_NUM),
+    new IpcSubSyscall ("<unknown16>", IPC_NUM),
+    new IpcSubSyscall ("<unknown17>",  IPC_NUM),
+    new IpcSubSyscall ("<unknown18>", IPC_NUM),
+    new IpcSubSyscall ("<unknown19>",  IPC_NUM),
+    new IpcSubSyscall ("<unknown20>", IPC_NUM),
     new IpcSubSyscall ("shmat",  IPC_NUM),
     new IpcSubSyscall ("shmdt", IPC_NUM),
     new IpcSubSyscall ("shmget",  IPC_NUM),
     new IpcSubSyscall ("shmctl", IPC_NUM)
   };
 
+  private static final IpcSubSyscall unknownIpcSubSyscall =
+    new IpcSubSyscall ("<unknown>", IPC_NUM);
+
   public static Syscall syscallByNum (Task task, int number)
   {
     if (number != SOCKET_NUM && number != IPC_NUM)
@@ -567,11 +573,17 @@
 	
 	if (number == SOCKET_NUM)
 	  {
-	    return socketSubcallList[subSyscallNumber];
+	    if (subSyscallNumber < socketSubcallList.length)
+	      return socketSubcallList[subSyscallNumber];
+	    else
+	      return unknownSocketSubSyscall;
 	  }
 	else
 	  {
-	    return ipcSubcallList[subSyscallNumber];
+	    if (subSyscallNumber < ipcSubcallList.length)
+	      return ipcSubcallList[subSyscallNumber];
+	    else
+	      return unknownIpcSubSyscall;
 	  }
       }
   }

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2007-07-31 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31 10:50 Mark Wielaard [this message]
2007-07-31 15:30 ` Andrew Cagney
2007-08-02  8:07   ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1185879001.3653.75.camel@dijkstra.wildebeest.org \
    --to=mark@klomp.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).