[PATCH v5 1/3] Introduce -l/--syscall-limit option

Kossi GLOKPOR hotkatz32 at gmail.com
Thu Mar 30 21:47:40 UTC 2023

What do you think about using the --daemonize options ? For example
with --daemonize=grandchild, the shell will be the parent of the
tracee, and detaching & stopping strace will have no incidence on it.
When we set an auto stop condition, we assume that strace can have to
stop while the tracee is still running, and enabling tracer
daemonization seems like a good way to prevent any issues with the
tracee when strace stops.


On Thu, Mar 30, 2023 at 4:55 AM Sahil Siddiq <icegambit91 at gmail.com> wrote:
> Hi,
> On Tuesday, 28 March 2023 17:23:30 IST Dmitry V. Levin wrote:
> > Hi,
> >
> > On Tue, Mar 28, 2023 at 01:11:50PM +0530, Sahil Siddiq wrote:
> > > [...]
> > > I was experimenting with the test a bit more and I have a few queries:
> > >
> > > 1. I applied your changes and experimented with it a bit. The test now
> > >     ends immediately. However, I noticed that in this case, strace terminates
> > >     completely and the tracee is reparented. Once this happens, the
> > >     process seems to be in the interruptible sleep state. If the tracee
> > >     is interactive and requires input from the user, it is unable to do
> > >     so because the process no longer remains in the foreground.
> > What is the alternative?  When strace is interrupted by signal,
> > it forwards the signal to strace_child process, but in this case
> > there is no signal to forward.  Also, I suppose --syscall-limit
> > would be used together with -p.
> In the ideal case, I would expect strace to terminate while the shell (such a bash)
> becomes the tracee's parent. I know one can use prctl() with "PR_SET_CHILD_SUBREAPER"
> to reparent an orphan process to the nearest living ancestor, but I do not know
> how to set this option for the shell.
> The options I have thought of are:
> 1. to simply let "init" become the parent of the orphaned tracee after strace
>     terminates. But if the detached tracee is interactive, it may interfere with
>     current shell.
> 2. to stop the tracee after strace terminates (which is probably not desired).
> 3. to let strace run and remain as the parent of the tracee without tracing more
>     syscalls. In this case, strace would have detached from the tracees but it won't
>     terminate. (I have understood that "-b execve" is per-tracee and not global.
>     However, I noticed that if every child/thread invokes execve and "-b execve"
>     detaches from all of those threads, strace still remains the parent and does not
>     terminate. In this case, strace would sleep for a minute even after detaching from
>     tracee in "strace--syscall-limit.test"
> Which approach would you suggest? Or is there another way that I could try out?
> Regards,
> Sahil
> --
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel

More information about the Strace-devel mailing list