From: Andries Brouwer <aebr@win.tue.nl>
To: Alex LIU <alex.liu@st.com>
Cc: "'Andries Brouwer'" <aebr@win.tue.nl>,
"'Pavel Machek'" <pavel@ucw.cz>,
linux-kernel@vger.kernel.org
Subject: Re: The purpose of PT_TRACESYSGOOD
Date: Tue, 11 Jan 2005 12:10:15 +0100 [thread overview]
Message-ID: <20050111111015.GC2760@pclin040.win.tue.nl> (raw)
In-Reply-To: <00ac01c4f7a6$c79e03f0$ac655e0a@sha.st.com>
>> /*
>> * 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?
Yes.
>From a baby ptrace demo:
#define SIGSYSTRAP (SIGTRAP | sysgood_bit)
int sysgood_bit = 0;
void set_sysgood(pid_t p) {
#ifdef PTRACE_O_TRACESYSGOOD
int i = ptrace(PTRACE_SETOPTIONS, p, 0, (void*) PTRACE_O_TRACESYSGOOD);
if (i == 0)
sysgood_bit = 0x80;
else
perror("PTRACE_O_TRACESYSGOOD");
#endif
}
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.
prev parent 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:
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=20050111111015.GC2760@pclin040.win.tue.nl \
--to=aebr@win.tue.nl \
--cc=alex.liu@st.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/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;
as well as URLs for NNTP newsgroup(s).