Re: [PATCH v2 8/9] perf srcline: Add missed addr2line closes

From: Namhyung Kim
Date: Fri Feb 09 2024 - 23:42:34 EST


On Fri, Feb 9, 2024 at 4:21 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>
> On Wed, Jan 31, 2024 at 4:15 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> >
> > The child_process for addr2line sets in and out to -1 so that pipes
> > get created. It is the caller's responsibility to close the pipes,
> > finish_command doesn't do it. Add the missed closes.
> >
> > Fixes: b3801e791231 ("perf srcline: Simplify addr2line subprocess")
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> > ---
> > tools/perf/util/srcline.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
> > index 034b496df297..7addc34afcf5 100644
> > --- a/tools/perf/util/srcline.c
> > +++ b/tools/perf/util/srcline.c
> > @@ -399,6 +399,8 @@ static void addr2line_subprocess_cleanup(struct child_process *a2l)
> > kill(a2l->pid, SIGKILL);
> > finish_command(a2l); /* ignore result, we don't care */
> > a2l->pid = -1;
> > + close(a2l->in);
> > + close(a2l->out);
>
> I was about to ask the stderr, but addr2line_subprocess_init()
> sets a2l->no_stderr already.
>
> I wish it could be handled in finish_command() but it seems
> the API allows setting external file descriptors (before calling
> start_command). Hmm..
>
> Anyway it looks like an independent fix.

I'll apply this separately.

Thanks,
Namhyung