From owner-freebsd-hackers Wed May 30 23:58: 4 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from public.guangzhou.gd.cn (mail1-smtp.guangzhou.gd.cn [202.105.65.221]) by hub.freebsd.org (Postfix) with SMTP id 710B137B423 for ; Wed, 30 May 2001 23:58:00 -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 jm253b15f6fe; Thu, 31 May 2001 06:56:11 -0000 Received: (from jyliu@localhost) by fatcow.home (8.11.3/8.11.3) id f4V6vB900405; Thu, 31 May 2001 14:57:11 +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@asd-g.com (diman) Subject: Re: Weird PT_DETACH Cc: freebsd-hackers@FreeBSD.org References: <006a01c0e911$96e68720$a701160a@fatcow> From: Jiangyi Liu Date: 31 May 2001 14:57:11 +0800 In-Reply-To: Message-ID: <878zjerooo.fsf@fatcow.home> Lines: 64 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, I tried to use (caddr_t)1 in PT_DETACH, but the code just failed. I'm confused. It just seems the execve is stopped. Maybe I'd read through the kernel source code to figure out where the problem is. Jiangyi diman@asd-g.com (diman) writes: > Hope your program not named "./test" ?? > I changed it to /bin/sh and it works just fine. > It was hard to debug due to my own proggie bug :) > bb. > > > #include > #include > #include > > int main() > { > pid_t pid; > > if(!(pid=fork())) { > /* child */ > ptrace(PT_TRACE_ME, 0, 0, 0); > puts("child speaking"); > execve("./test", NULL, NULL); <---------- ?? > } else { > wait(0); > ptrace(PT_DETACH, pid, (caddr_t)1, 0); <---------- also > exit(0); > } > } > > > > > > On Wed, 30 May 2001, Jiangyi Liu wrote: > > > > > > > > > If i understand ptrace(2) manual page correctly, > > > you should use > > > ptrace(PT_DETACH,pid,(caddr_t)1,0) > > > instead of > > > ptrace(PT_DETACH,pid,0,0) . > > > > > > > If you read my first post again, you will know that indeed I've tried to use (caddr_t)1 but failed too. > > > > > BTW you code is *very hard to debug* on my 4.1.1 :) > > > What your uname -a tells you? > > > > Why? My box is 4.3-STABLE. > > > > Jiangyi > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message