two proposed linuxulator fixes + ptrace

Yanko Yankulov yanko.yankulov at gmail.com
Fri Jun 15 07:23:09 UTC 2018


Thanks for the hint. It turned that we already have all the info due to the
call to  fill_kinfo_proc(p, &kp);

Proper patch attached. Verified with the ptrace patch, that correct values
are reported in PPid & TracerPid.

Regarding the ptrace patch - for some reason I am not receiving a
registration mail from reviews.freebsd.org so I am a bit stuck.

Best,

On Thu, Jun 14, 2018 at 5:16 PM, Konstantin Belousov <kostikbel at gmail.com>
wrote:

> 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);
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-linprocfs-proc-pid-status-add-TracerPid.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20180615/4caff249/attachment.bin>


More information about the freebsd-emulation mailing list