[PATCH v2 2/2] ioctl console test v2

Eugene Syromiatnikov esyr at redhat.com
Wed Mar 25 02:08:48 UTC 2020


On Mon, Mar 23, 2020 at 04:06:56PM +0530, Bran S wrote:
> > > I think I am missing something obvious here. PR_GET_CHILD_SUBREAPER
> > > tells if current process is a subreaper.
> > > ----
> > >     int ret;
> > >     unsigned long arg2;
> > >     ret = prctl(PR_GET_CHILD_SUBREAPER, &arg2);
> > >
> > >     printf("ret: %d\n", ret);
> > >     printf("arg2: %d\n", arg2);
> > > ----
> > > How can it be used to confirm that the ppid process is a subreaper is
> > > unclear to me ? I will look through it all once again with fresh eyes.
> >
> > Oh, you're right, I've overlooked that bit, my apologies.  In that case,
> > it seems that the easiest way is to have an additional helper program
> > that makes itself reparented and reports its PPID.
> 
> So the idea now is:
> Two programs tracer_ppid_sgid_sid and tracer_helper.
> Now both of these will be reparented and will report their respective PPID.

tracer_ppid_sgid_sid reports tracer's PPID, yes.

> The strace-DDD.test shell script will then match the PPID of both. If
> it matches then its successful.
> Is this correct ?

Yes.



More information about the Strace-devel mailing list