From owner-freebsd-hackers Thu May 31 17:32:42 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from public.guangzhou.gd.cn (mail2-smtp.guangzhou.gd.cn [202.105.65.222]) by hub.freebsd.org (Postfix) with SMTP id 36AA437B422 for ; Thu, 31 May 2001 17:32:39 -0700 (PDT) (envelope-from gzjyliu@public.guangzhou.gd.cn) Received: from fatcow.home([203.93.59.244]) by public.guangzhou.gd.cn(JetMail 2.5.3.0) with SMTP id jm123b174ee8; Fri, 1 Jun 2001 00:30:54 -0000 Received: (from jyliu@localhost) by fatcow.home (8.11.3/8.11.3) id f510WOU00470; Fri, 1 Jun 2001 08:32:24 +0800 (CST) (envelope-from gzjyliu@public.guangzhou.gd.cn) X-Authentication-Warning: fatcow.home: jyliu set sender to gzjyliu@public.guangzhou.gd.cn using -f To: diman Subject: Re: FIX needed. Was: Weird PT_DETACH References: Cc: freebsd-hackers@FreeBSD.org From: Jiangyi Liu Date: 01 Jun 2001 08:32:23 +0800 In-Reply-To: Message-ID: <878zjdnip4.fsf@fatcow.home> Lines: 38 User-Agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, diman 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