On Wed, Sep 03, 2014 at 10:16:29AM +0300, Konstantin Belousov wrote:
> On Wed, Sep 03, 2014 at 06:25:35AM +0000, Mateusz Guzik wrote:
> > Author: mjg
> > Date: Wed Sep  3 06:25:34 2014
> > New Revision: 270993
> > URL: http://svnweb.freebsd.org/changeset/base/270993
> > 
> > Log:
> >   Fix up proc_realparent to always return correct process.
> >   
> >   Prior to the change it would always return initproc for non-traced 
> > processes.
> >   
> >   This fixes ps apparently always returning 1 as ppid.
> >   
> >   Pointy hat:       mjg
> No, this is my bug.  Thank you for fixing it.  It is a consequence of
> the last minute 'safety' change I did.
> 

I used it without veryfing it returns correct results. I'm happy to
share the blame. :>

> >   Reported by:      many
> >   MFC after:        1 week
> I suggest to merge in 3 days.
> 

Ok.

> > 
> > Modified:
> >   head/sys/kern/kern_exit.c
> > 
> > Modified: head/sys/kern/kern_exit.c
> > ==============================================================================
> > --- head/sys/kern/kern_exit.c       Wed Sep  3 05:14:50 2014        
> > (r270992)
> > +++ head/sys/kern/kern_exit.c       Wed Sep  3 06:25:34 2014        
> > (r270993)
> > @@ -104,8 +104,12 @@ proc_realparent(struct proc *child)
> >  
> >     sx_assert(&proctree_lock, SX_LOCKED);
> >     if ((child->p_treeflag & P_TREE_ORPHANED) == 0) {
> > -           return (child->p_pptr->p_pid == child->p_oppid ?
> > -               child->p_pptr : initproc);
> > +           if (child->p_oppid == 0 ||
> > +               child->p_pptr->p_pid == child->p_oppid)
> > +                   parent = child->p_pptr;
> > +           else
> > +                   parent = initproc;
> > +           return (parent);
> >     }
> >     for (p = child; (p->p_treeflag & P_TREE_FIRST_ORPHAN) == 0;) {
> >             /* Cannot use LIST_PREV(), since the list head is not known. */



-- 
Mateusz Guzik <mjguzik gmail.com>
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to