public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] strace fix
Date: Tue, 31 Jul 2001 00:49:59 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590693005962@msgid-missing> (raw)

Recently I noticed that strace reports bogus syscall return values
after any execve() system call.  This was quite annoying and it turns
out to be due to the fact that strace was falling out of sync with the
kernel due to an extra SIGTRAP that is being sent from the kernel's
ELF loader.  The patch below fixes this problem.

	--david

--- defs.h.~1.17.~	Sun Sep  3 16:57:48 2000
+++ defs.h	Mon Jul 30 17:44:56 2001
@@ -274,7 +274,9 @@
 #define TCB_FOLLOWFORK	00400	/* Process should have forks followed */
 #define TCB_REPRINT	01000	/* We should reprint this syscall on exit */
 #ifdef LINUX
-#if defined(ALPHA) || defined(SPARC) || defined(POWERPC)
+#if defined(ALPHA) || defined(SPARC) || defined(POWERPC) || defined(IA64)
+  /* When execve'ing an ELF binary, the kernel sends an extra SIGTRAP
+     which we need to ignore.  */
 #define TCB_WAITEXECVE	02000	/* ignore SIGTRAP after exceve */
 #endif /* ALPHA */
 #endif /* LINUX */
--- process.c.~1.26.2.2.~	Thu May 17 01:39:53 2001
+++ process.c	Mon Jul 30 17:40:37 2001
@@ -1162,7 +1162,7 @@
 		}
 	}
 #ifdef LINUX
-#if defined(ALPHA) || defined(SPARC) || defined(POWERPC)
+#if defined(ALPHA) || defined(SPARC) || defined(POWERPC) || defined(IA64)
 	tcp->flags |= TCB_WAITEXECVE;
 #endif /* ALPHA || SPARC || POWERPC */
 #endif /* LINUX */
--- syscall.c.~1.25.2.3.~	Tue Mar  6 17:13:25 2001
+++ syscall.c	Mon Jul 30 17:42:21 2001
@@ -691,6 +691,10 @@
 			if (upeek(pid, PT_R8, &scno) < 0)
 				return -1;
 		} else {
+			if ((tcp->flags & TCB_WAITEXECVE)) {
+				tcp->flags &= ~TCB_WAITEXECVE;
+				return 0;
+			}
 			if (upeek (pid, PT_R15, &scno) < 0)
 				return -1;
 		}


                 reply	other threads:[~2001-07-31  0:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=marc-linux-ia64-105590693005962@msgid-missing \
    --to=davidm@hpl.hp.com \
    --cc=linux-ia64@vger.kernel.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