linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* The purpose of PT_TRACESYSGOOD
@ 2005-01-10  3:58 Alex LIU
  2005-01-10 20:24 ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Alex LIU @ 2005-01-10  3:58 UTC (permalink / raw)
  To: linux-kernel

Hi:

What's the effect of PT_TRACESYSGOOD flag? I found it's used only set in ptrace_setoptions,which is called in the function ptrace_request. And the PT_TRACESYSGOOD flag will be requested in do_syscall_trace. What's the purpose of that flag? Thanks! 

Alex


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: The purpose of PT_TRACESYSGOOD
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2005-01-10 20:24 UTC (permalink / raw)
  To: Alex LIU; +Cc: linux-kernel

Hi!

> What's the effect of PT_TRACESYSGOOD flag? I found it's used only set in ptrace_setoptions,which is called in the function ptrace_request. And the PT_TRACESYSGOOD flag will be requested in do_syscall_trace. What's the purpose of that flag? Thanks! 
> 

Search archives, it was needed for subterfugue.
										Pavel
-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: The purpose of PT_TRACESYSGOOD
  2005-01-10 20:24 ` Pavel Machek
@ 2005-01-11  2:30   ` Andries Brouwer
  2005-01-11  6:28     ` Alex LIU
  0 siblings, 1 reply; 5+ messages in thread
From: Andries Brouwer @ 2005-01-11  2:30 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Alex LIU, linux-kernel


>> What's the effect of PT_TRACESYSGOOD flag? I found it's used only set
>> in ptrace_setoptions, which is called in the function
>> ptrace_request. And the PT_TRACESYSGOOD flag will be requested in
>> do_syscall_trace. What's the purpose of that flag?


/*
 * 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.
 */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: The purpose of PT_TRACESYSGOOD
  2005-01-11  2:30   ` Andries Brouwer
@ 2005-01-11  6:28     ` Alex LIU
  2005-01-11 11:10       ` Andries Brouwer
  0 siblings, 1 reply; 5+ messages in thread
From: Alex LIU @ 2005-01-11  6:28 UTC (permalink / raw)
  To: 'Andries Brouwer', 'Pavel Machek'; +Cc: linux-kernel

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?
Thanks a lot! 

Alex

Andries Brouwer wrote:

>> What's the effect of PT_TRACESYSGOOD flag? I found it's used only set 
>> in ptrace_setoptions, which is called in the function ptrace_request. 
>> And the PT_TRACESYSGOOD flag will be requested in do_syscall_trace. 
>> What's the purpose of that flag?

>/*
> * 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.
> */


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: The purpose of PT_TRACESYSGOOD
  2005-01-11  6:28     ` Alex LIU
@ 2005-01-11 11:10       ` Andries Brouwer
  0 siblings, 0 replies; 5+ messages in thread
From: Andries Brouwer @ 2005-01-11 11:10 UTC (permalink / raw)
  To: Alex LIU; +Cc: 'Andries Brouwer', 'Pavel Machek', linux-kernel

>> /*
>>  * 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-11 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).