Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2018 17:16:04 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Yanko Yankulov <yanko.yankulov@gmail.com>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: two proposed linuxulator fixes + ptrace
Message-ID:  <20180614141604.GA2493@kib.kiev.ua>
In-Reply-To: <CABTd0_pdF9RGmJHYDoL5f2ctewfWU_e0DsF=hkuqTVtFW2uhtA@mail.gmail.com>
References:  <CABTd0_pqdAtHMH9gSJdebstASuoomYw1XLbkbbsMCUvtE-=vDA@mail.gmail.com> <20180614101324.GW2493@kib.kiev.ua> <CABTd0_p=5cqsN5TKtEWXY_oQXtGdJOyMHEzjoUJeaYcKShLCRQ@mail.gmail.com> <20180614123659.GZ2493@kib.kiev.ua> <CABTd0_pdF9RGmJHYDoL5f2ctewfWU_e0DsF=hkuqTVtFW2uhtA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 14, 2018 at 04:11:52PM +0300, Yanko Yankulov wrote:
> > > > For the patch 1, TracePid, can you explain what is the meaning of the
> > > > pid reported ?
> > > >
> > > > The TracerPid is the PID of the process currently ptrace-ing the
> > process.
> > > TracerPid 0 means no active tracer. So the patch is not semantically
> > > correct as it always reports no tracer, but it got the program running.
> > Ok, but what is the tracer ?  Is it ptrace(2) debugger, or something
> > else ?
> >
> 
> Yes, any ptrace(2) debugger/truss/strace/whatever. The Linux code is:
> 
> tracer = ptrace_parent(p);
> if (tracer)
>       tpid = task_pid_nr_ns(tracer, ns);

I think this should be like
	PROC_LOCK(p);
	tpid = (p->p_flag & P_TRACED) != 0 ? p->p_ppid : 0;
	PROC_UNLOCK(p);
	sx_slock(&proctree_lock);
	parent_pid = proc_realparent(p)->p_pid;
	sx_sunlock(&proctree_lock);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180614141604.GA2493>