[PATCH v1] perf vdso: Missed put on 32-bit dsos

Ian Rogers posted 1 patch 2 months, 2 weeks ago
tools/perf/util/vdso.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH v1] perf vdso: Missed put on 32-bit dsos
Posted by Ian Rogers 2 months, 2 weeks ago
If the dso type doesn't match then NULL is returned but the dso should
be put first.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/vdso.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 1b6f8f6db7aa..c12f5d8c4bf6 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -308,8 +308,10 @@ static struct dso *machine__find_vdso(struct machine *machine,
 		if (!dso) {
 			dso = dsos__find(&machine->dsos, DSO__NAME_VDSO,
 					 true);
-			if (dso && dso_type != dso__type(dso, machine))
+			if (dso && dso_type != dso__type(dso, machine)) {
+				dso__put(dso);
 				dso = NULL;
+			}
 		}
 		break;
 	case DSO__TYPE_X32BIT:
-- 
2.46.0.662.g92d0881bb0-goog
Re: [PATCH v1] perf vdso: Missed put on 32-bit dsos
Posted by Arnaldo Carvalho de Melo 2 months, 2 weeks ago
On Thu, Sep 12, 2024 at 11:27:57AM -0700, Ian Rogers wrote:
> If the dso type doesn't match then NULL is returned but the dso should
> be put first.

I guess we can add:

Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking")

?

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/vdso.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
> index 1b6f8f6db7aa..c12f5d8c4bf6 100644
> --- a/tools/perf/util/vdso.c
> +++ b/tools/perf/util/vdso.c
> @@ -308,8 +308,10 @@ static struct dso *machine__find_vdso(struct machine *machine,
>  		if (!dso) {
>  			dso = dsos__find(&machine->dsos, DSO__NAME_VDSO,
>  					 true);
> -			if (dso && dso_type != dso__type(dso, machine))
> +			if (dso && dso_type != dso__type(dso, machine)) {
> +				dso__put(dso);
>  				dso = NULL;
> +			}
>  		}
>  		break;
>  	case DSO__TYPE_X32BIT:
> -- 
> 2.46.0.662.g92d0881bb0-goog
Re: [PATCH v1] perf vdso: Missed put on 32-bit dsos
Posted by Ian Rogers 2 months, 2 weeks ago
On Thu, Sep 12, 2024 at 12:15 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> On Thu, Sep 12, 2024 at 11:27:57AM -0700, Ian Rogers wrote:
> > If the dso type doesn't match then NULL is returned but the dso should
> > be put first.
>
> I guess we can add:
>
> Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking")
>
> ?

Yep, that's the one that added the reference count increment.

Thanks,
Ian
Re: [PATCH v1] perf vdso: Missed put on 32-bit dsos
Posted by Ian Rogers 2 months, 1 week ago
On Thu, Sep 12, 2024 at 12:31 PM Ian Rogers <irogers@google.com> wrote:
>
> On Thu, Sep 12, 2024 at 12:15 PM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > On Thu, Sep 12, 2024 at 11:27:57AM -0700, Ian Rogers wrote:
> > > If the dso type doesn't match then NULL is returned but the dso should
> > > be put first.
> >
> > I guess we can add:
> >
> > Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking")
> >
> > ?
>
> Yep, that's the one that added the reference count increment.

Noticed this isn't in the tree yet, do I need to resend for the fixes tag?

Thanks,
Ian
Re: [PATCH v1] perf vdso: Missed put on 32-bit dsos
Posted by Namhyung Kim 2 months, 1 week ago
On Mon, Sep 23, 2024 at 12:01:23PM -0700, Ian Rogers wrote:
> On Thu, Sep 12, 2024 at 12:31 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Thu, Sep 12, 2024 at 12:15 PM Arnaldo Carvalho de Melo
> > <acme@kernel.org> wrote:
> > >
> > > On Thu, Sep 12, 2024 at 11:27:57AM -0700, Ian Rogers wrote:
> > > > If the dso type doesn't match then NULL is returned but the dso should
> > > > be put first.
> > >
> > > I guess we can add:
> > >
> > > Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking")
> > >
> > > ?
> >
> > Yep, that's the one that added the reference count increment.
> 
> Noticed this isn't in the tree yet, do I need to resend for the fixes tag?

Arnaldo, can you please pick this up to perf-tools?

Thanks,
Namhyung

Re: [PATCH v1] perf vdso: Missed put on 32-bit dsos
Posted by Arnaldo Carvalho de Melo 2 months ago
On Mon, Sep 23, 2024 at 04:24:23PM -0700, Namhyung Kim wrote:
> On Mon, Sep 23, 2024 at 12:01:23PM -0700, Ian Rogers wrote:
> > On Thu, Sep 12, 2024 at 12:31 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > On Thu, Sep 12, 2024 at 12:15 PM Arnaldo Carvalho de Melo
> > > <acme@kernel.org> wrote:
> > > >
> > > > On Thu, Sep 12, 2024 at 11:27:57AM -0700, Ian Rogers wrote:
> > > > > If the dso type doesn't match then NULL is returned but the dso should
> > > > > be put first.
> > > >
> > > > I guess we can add:
> > > >
> > > > Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking")
> > > >
> > > > ?
> > >
> > > Yep, that's the one that added the reference count increment.
> > 
> > Noticed this isn't in the tree yet, do I need to resend for the fixes tag?
> 
> Arnaldo, can you please pick this up to perf-tools?

Right, I just did that, b4 was nice enough to notice the Fixes tag I
suggested, its in my local branch, will push out soon.

- Arnaldo