linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jianlin Lv <Jianlin.Lv@arm.com>,
	peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, srikar@linux.vnet.ibm.com,
	adrian.hunter@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] perf probe: Added protection to avoid endless loop
Date: Wed, 3 Feb 2021 13:22:58 -0300	[thread overview]
Message-ID: <20210203162258.GF854763@kernel.org> (raw)
In-Reply-To: <20210204000814.7bebaeda0edb54f121159fbd@kernel.org>

Em Thu, Feb 04, 2021 at 12:08:14AM +0900, Masami Hiramatsu escreveu:
> On Wed,  3 Feb 2021 22:57:02 +0800
> Jianlin Lv <Jianlin.Lv@arm.com> wrote:
> 
> > if dwarf_offdie() return NULL, the continue statement forces the next
> > iteration of the loop without update variable off. It will cause an
> > endless loop in the process of traversing the compilation unit.
> > So added exception protection for loop CUs.
> > 
> 
> Thanks for the quick update!
> 
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thanks, applied.

- Arnaldo

 
> Thank you,
> 
> > Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
> > ---
> > v2: removed the statement that updates variable in the function argument.
> > ---
> >  tools/perf/util/probe-finder.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> > index 76dd349aa48d..1b118c9c86a6 100644
> > --- a/tools/perf/util/probe-finder.c
> > +++ b/tools/perf/util/probe-finder.c
> > @@ -1187,8 +1187,10 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
> >  	while (!dwarf_nextcu(dbg->dbg, off, &noff, &cuhl, NULL, NULL, NULL)) {
> >  		/* Get the DIE(Debugging Information Entry) of this CU */
> >  		diep = dwarf_offdie(dbg->dbg, off + cuhl, &pf->cu_die);
> > -		if (!diep)
> > +		if (!diep) {
> > +			off = noff;
> >  			continue;
> > +		}
> >  
> >  		/* Check if target file is included. */
> >  		if (pp->file)
> > @@ -1949,8 +1951,10 @@ int debuginfo__find_line_range(struct debuginfo *dbg, struct line_range *lr)
> >  
> >  		/* Get the DIE(Debugging Information Entry) of this CU */
> >  		diep = dwarf_offdie(dbg->dbg, off + cuhl, &lf.cu_die);
> > -		if (!diep)
> > +		if (!diep) {
> > +			off = noff;
> >  			continue;
> > +		}
> >  
> >  		/* Check if target file is included. */
> >  		if (lr->file)
> > -- 
> > 2.25.1
> > 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>

-- 

- Arnaldo

      reply	other threads:[~2021-02-03 16:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 14:57 [PATCH v2] perf probe: Added protection to avoid endless loop Jianlin Lv
2021-02-03 15:08 ` Masami Hiramatsu
2021-02-03 16:22   ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210203162258.GF854763@kernel.org \
    --to=acme@kernel.org \
    --cc=Jianlin.Lv@arm.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).