[PATCH v2 2/2] ioctl console test v2
Eugene Syromiatnikov
esyr at redhat.com
Fri Mar 13 18:12:28 UTC 2020
On Fri, Mar 13, 2020 at 04:25:03PM +0530, Bran S wrote:
> On Wed, 11 Mar 2020 at 19:15, Eugene Syromiatnikov <esyr at redhat.com> wrote:
> >
> > On Wed, Mar 11, 2020 at 03:01:38PM +0530, Bran S wrote:
> > > > Have you considered fixing strace-DDD.test?
> > >
> > > It is mentioned here[1] that it doesn't fail when built outside
> > > systemd user slice.
> >
> > There are actually two issues: one is itermittent and is common with
> > strace-DD.test, namingly, the waiting of the strace's termination is not
> > done properly, so it checks the actual strace's output too early
> > sometimes; the other one is the one you've referenced, yes.
>
> Will get to strace-DD.test after solving strace-DDD.test ?
> Or are they somehow dependent and need to be solve at once ?
>
> > > So should we check if the ppid is of the systemd instead of checking for pid 1 ?
> > > Would that be a solution or something else ?
> >
> > Why systemd? Any process can be child subreaper for whatever reasons.
> > Yes, it's likely that the solution is to get the subreaper's PID and
> > check against it instead of checking against hard-coded 1.
>
> So if any process can be subreaper i.e. ppid can be anything greater
> than equal to 1, then what is the point of matching the process id ?
Well, matching PPID against child subreaper's PID confirms that
the tracer is re-parented by it.
> Wouldn't it be enough to just confirm that a process whose pid is
> equal to ppid exists ?
You've lost me here. May I ask you to rephrase it, please?
> Would this solve the issue ?
> -[ "$ppid" -eq 1 ] &&
> +[ "$ppid" -ge 1 ] &&
Well, the check that PPID is no less than 0 is effectively useless,
as it is always no less than 1. As I said, it has to be checked
against test's child subreaper, or at least checked that it is outside
tracee's PID tree (however, checking it against child subreaper's PID
is easier and makes the test more precise).
> > > [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947396
More information about the Strace-devel
mailing list