From owner-freebsd-current@FreeBSD.ORG Mon Apr 14 14:52:22 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 38E4F37B401; Mon, 14 Apr 2003 14:52:22 -0700 (PDT) Received: from sccrmhc02.attbi.com (sccrmhc02.attbi.com [204.127.202.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D99D43F75; Mon, 14 Apr 2003 14:52:21 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org (12-232-168-4.client.attbi.com[12.232.168.4]) by sccrmhc02.attbi.com (sccrmhc02) with ESMTP id <20030414215219002006ubs1e>; Mon, 14 Apr 2003 21:52:20 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id OAA27464; Mon, 14 Apr 2003 14:52:17 -0700 (PDT) Date: Mon, 14 Apr 2003 14:52:16 -0700 (PDT) From: Julian Elischer To: John Baldwin In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: marcel@FreeBSD.org cc: julian@FreeBSD.org cc: current@FreeBSD.org Subject: Re: Bug in rev 1.3 of sys/i386/linux/linux_ptrace.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2003 21:52:22 -0000 On Mon, 14 Apr 2003, John Baldwin wrote: > In the linux_ptrace() function there is the following code: > > case PTRACE_GETFPXREGS: { > #ifdef CPU_ENABLE_SSE > struct proc *p; > struct thread *td2; > > ... > > /* not being traced... */ > if ((p->p_flag & P_TRACED) == 0) { > error = EPERM; > goto fail; > } > > /* not being traced by YOU */ > if (p->p_pptr != td->td_proc) { > error = EBUSY; > goto fail; > } > > /* not currently stopped */ > if ((p->p_flag & (P_TRACED|P_WAITED)) == 0) { > error = EBUSY; > goto fail; > } > > ... > > Now, since we've already checked P_TRACED above, this last > check will never fail. The diff in rev 1.3 was: > > - if (p->p_stat != SSTOP || (p->p_flag & P_WAITED) == 0) { > + if ((p->p_flag & (P_TRACED|P_WAITED)) == 0) { > > So should this be (P_STOPPED|P_WAITED) instead? Or maybe just > (P_STOPPED_TRACE|P_WAITED)? probably the 2nd option, except that I am not 100% sure without looking at the code, (which I don't have alot of time for right now) (you will sympathise more after June 4) (my Birthday BTW) that P_STOPPED_TRACE is fully implemented.. some other hands have been in there and I haven't followed what they did.. > > -- > > John Baldwin <>< http://www.FreeBSD.org/~jhb/ > "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ >