Skip site navigation (1)Skip section navigation (2)
Date:      01 Jun 2001 08:32:23 +0800
From:      Jiangyi Liu <gzjyliu@public.guangzhou.gd.cn>
To:        diman <diman@asd-g.com>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: FIX needed.  Was: Weird PT_DETACH
Message-ID:  <878zjdnip4.fsf@fatcow.home>
In-Reply-To: <Pine.BSF.4.21.0105311233490.266-300000@portal.none.ua>
References:  <Pine.BSF.4.21.0105311233490.266-300000@portal.none.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

diman <diman@asd-g.com> writes:
> 
> 	Another problem(?) Jiangui found considers PT_DETACH ptrace(2)
> 	call.  While i'm attaching to a running process via PT_ATTACH,
> 	PT_DETACH works well as expected.
> 	If i instead use PT_TRACE_ME -> execve -> PT_DETACH,
> 	child always got killed by SIGTRAP.
> 	I'm not sure it's a bug - needs play a bit more with gdb... ..
>

Maybe it's not a bug. It's a feature. :-) Notice execve() in
sys/kern/kern_exec.c:

        /*
	 * If tracing the process, trap to debugger so breakpoints
	 * 	can be set before the program executes.
	 */
	STOPEVENT(p, S_EXEC, 0);

	if (p->p_flag & P_TRACED)
		psignal(p, SIGTRAP);


> 	Attached is a simple program i used for tests.
> 	Note that Jiangyi Liu reported same effects on 4.3-S.
> 
> 	Sorry Jiangyi Liu, I wrong understood you yesterday -
> 	needs more more more sleeping :~)
>

Never mind. Maybe enough sleeping and morning jogging do good to
hacking. But it's almost impossible. :-)


Cheers,
Jiangyi Liu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?878zjdnip4.fsf>