[prev in list] [next in list] [prev in thread] [next in thread] 

List:       strace
Subject:    [patch] get_scno should test TCB_INSYSCALL at the beginning
From:       jochen () penguin-breeder ! org
Date:       2003-09-11 7:50:30
[Download RAW message or body]

get_scno should test TCB_INSYSCALL at the beginning
the function get_scno in signal.c should test whether
the scno needs to be updated at the beginning, instead
of just determining it anyway and deciding at the end
whether it needs to be updated or not.

get_scno is invoked when a syscall is entered and when
it's left. When it's entered, we need the scno anyway,
but when it's left we don't need. Even more, when it's
left we might be already in some other context (signal
handler or similar), so we cannot determine it anyway.
Now on some architectures (s390) this may result in a
(failing) attempt to access memory of the traced
process to determine the scno.

and it's more efficient anyway.

see attached patch.

regards
-- jochen

ps: i also filed this as bug 803946 at your sf.net site

["get_scno.patch" (text/plain)]

--- strace/syscall.c.orig	2003-09-10 21:02:20.000000000 +0200
+++ strace/syscall.c	2003-09-10 21:04:29.000000000 +0200
@@ -735,6 +735,8 @@
 	int pid = tcp->pid;
 #endif /* !PROCFS */
 
+	if (tcp->flags & TCB_INSYSCALL)
+		return 1;
 #ifdef LINUX
 #if defined(S390) || defined(S390X)
 	if (tcp->flags & TCB_WAITEXECVE) {
@@ -1197,8 +1199,7 @@
 #endif /* FREEBSD */
 #endif /* !HAVE_PR_SYSCALL */
 #endif /* USE_PROCFS */
-	if (!(tcp->flags & TCB_INSYSCALL))
-		tcp->scno = scno;
+	tcp->scno = scno;
 	return 1;
 }
 

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic