This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

System call number cached with help from SyscallObserver


It is not *always* right to get system call number from a certain
register when exit from a system call, such as rt_sigreturn.  This
problem has been discussed in this thread,

http://sources.redhat.com/ml/frysk/2006-q3/msg00305.html

Andrew explained that *all* the registers have been flushed to restore
the state of that thread, so "orig_eax"(ia32), "orig_rax"(x86_64) or
"gpr0"(ppc) does not contain the value of system call number any more.

And I could also find that there is a problem caused by this in IRC log,

<npremji> pmuldoon, I'm getting some issues with bash and syscalls
<pmuldoon> npremji: I'm building now, but what issues?
<npremji> a bunch of negative syscall number java runtime exceptions
<npremji> java.lang.RuntimeException: Negative Syscall Number:-1
<npremji>    at frysk.proc.Syscall.syscallByNum(FryskGui)
<npremji>    at frysk.proc.LinuxIa32Syscall.syscallByNum(FryskGui)
<npremji>    at frysk.proc.LinuxIa32$1.getSyscall(FryskGui)
<npremji>    at
frysk.gui.monitor.observers.SysCallUtilyInfo.getReturnInfoFromSyscall(FryskGui)
<npremji>    at
frysk.gui.monitor.observers.TaskSyscallObserver.exitBottomHalf(FryskGui)
<npremji>    at
frysk.gui.monitor.observers.TaskSyscallObserver$2.run(FryskGui)
<npremji>    at org.gnu.glib.CustomEvents.runEvents(libgtkjava-2.8.so)
<npremji>    at org.gnu.gtk.Gtk.gtk_main(libgtkjava-2.8.so)
<pmuldoon> npremji: probably from the Sycall checkin last night
<npremji>    at org.gnu.gtk.Gtk.main(libgtkjava-2.8.so)
<npremji>    at frysk.gui.Gui.gui(FryskGui)
<npremji>    at frysk.gui.FryskGui.main(FryskGui)

It is not the fault for Syscall to check the range of system call
number, but the wrong value when we want to get the system call number
from a register.

The only thing I could figure out to fix this problem is to add a
SyscallObserver to update system call number cached in
SyscallEventInfo, or some where else, when enter in a system call, and
return system call numbers to other objects that want to know system
call information. (Any other solutions, free to tell me)
However, some requirements are needed here,

1) This SyscallObserver should be notified first when a syscall come
in to update system call number, and other observers will get system
call number from the cached value later.  How to make this 
SyscallObserver to be the first?

2) This SyscallObserver could not be added if no other "clients" add
SyscallObserver for themselves.  If no one add SyscallObserver, we do
not need add SyscallObserver to update system call number also.

That is to say, this SyscallObserver for system call number update
should be added firstly if other "clients", such as ftrace or UI,
want to add their SyscallObservers.

Any comments?  Thanks in advance!

-- 
Yao Qi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]