archive mirror
 help / color / mirror / Atom feed
From: Andries Brouwer <>
To: Alex LIU <>
Cc: "'Andries Brouwer'" <>,
	"'Pavel Machek'" <>,
Subject: Re: The purpose of PT_TRACESYSGOOD
Date: Tue, 11 Jan 2005 12:10:15 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <00ac01c4f7a6$c79e03f0$>

>> /*
>>  * A child stopped at a syscall has status as if it received SIGTRAP.
>>  * In order to distinguish between SIGTRAP and syscall, some kernel
>>  * versions have the PTRACE_O_TRACESYSGOOD option, that sets an extra
>>  * bit 0x80 in the syscall case.
>>  */

> Then I think the tracing thread should call the ptrace_request to set
> PTRACE_O_TRACESYSGOOD flag of the traced thread first before
> ptrace(PTRACE_SYSCALL...) ,right?


>From a baby ptrace demo:

#define SIGSYSTRAP      (SIGTRAP | sysgood_bit)

int sysgood_bit = 0;

void set_sysgood(pid_t p) {
        int i = ptrace(PTRACE_SETOPTIONS, p, 0, (void*) PTRACE_O_TRACESYSGOOD);
        if (i == 0)
                sysgood_bit = 0x80;

and now the signal SIGSYSTRAP signifies a system call when the sysgood bit
was implemented, anything different from SIGSYSTRAP is guaranteed to be a signal.

      reply	other threads:[~2005-01-11 11:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10  3:58 The purpose of PT_TRACESYSGOOD Alex LIU
2005-01-10 20:24 ` Pavel Machek
2005-01-11  2:30   ` Andries Brouwer
2005-01-11  6:28     ` Alex LIU
2005-01-11 11:10       ` Andries Brouwer [this message]

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:

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

  git send-email \ \ \ \ \ \

* 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 NNTP newsgroup(s).