Date: Mon, 14 Apr 2003 14:12:39 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: John Baldwin <jhb@FreeBSD.org> Cc: current@FreeBSD.org Subject: Re: Bug in rev 1.3 of sys/i386/linux/linux_ptrace.c Message-ID: <20030414211239.GA843@athlon.pn.xcllnt.net> In-Reply-To: <XFMail.20030414161206.jhb@FreeBSD.org> References: <XFMail.20030414161206.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 14, 2003 at 04:12:06PM -0400, John Baldwin wrote: > In the linux_ptrace() function there is the following code: *snip* > /* 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)? I don't know the difference between P_STOPPED and P_STOPPED_TRACE but yes, we should check whether the process is stopped. The equivalent in sys/kern/sys_process.c is: if (!P_SHOULDSTOP(p) || (p->p_flag & P_WAITED) == 0) { P_SHOULDSTOP(p) expands to: ((p)->p_flag & P_STOPPED) Using P_STOPPED makes us bug-for-bug compatible... -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030414211239.GA843>