This is the mail archive of the
mailing list for the frysk project.
Re: System call number cached with help from SyscallObserver
- From: Mark Wielaard <mark at klomp dot org>
- To: Yao Qi <qiyaoltc at cn dot ibm dot com>
- Cc: frysk <frysk at sourceware dot org>
- Date: Fri, 15 Sep 2006 13:47:57 +0200
- Subject: Re: System call number cached with help from SyscallObserver
- References: <20060915070503.GD14319@GreenHouse.cn.ibm.com>
On Fri, 2006-09-15 at 15:05 +0800, Yao Qi wrote:
> 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,
> 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.
> 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)
SyscallObservers are all "equal", you cannot currently add one that has
preference over any of the others. But the Task or TaskState could hold
this info if needed.
What is precisely the use case? When does a SyscallObserver want to get
at the syscall number (or arguments) on exit? Can we assume that a
SyscallObserver will record Enter/Exit pairs themselves? If so then a
SyscallObserver should probably have saved the syscall number and any
arguments it is interested in on updateSyscallEnter() so it can use them
in updateSyscallExit(). Then when updateSyscallExit() is called the only
"valid" thing to query is the return value.
If the above is accurate then I think we can/should provide some support
inside the TaskState machinery. The TaskState should have an acurate
view of whether the Task is inside or outside a system call. What we
could add is a way for the TaskObserver.Syscall.updateSyscallEnter() to
indicate whether or not it is actually interested in updateSyscallExit()
For example by letting it return a Action CONTINUE_INTERESTED or
BLOCKED_INTERESTED. If any other Action is returned the observer will
not be called when the syscall exits.
That way we can make sure that updateSyscallExit() is only called for
any syscall that the observer is actually interested in. And if it is
interested then we can assume it will have saved the syscall number and
any arguments it is interested in itself and that the only thing that it
might want to query on exit is the return value.