Skip to contentSkip to conversation

perf vdso: Missed put on 32-bit dsos

PATCH In review Ian Rogers 3 participants 6 messages Sep 12, 2024 – Sep 27, 2024 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf vdso: Missed put on 32-bit dsos

If the dso type doesn't match then NULL is returned but the dso should be put first.

---
 tools/perf/util/vdso.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/vdso.c +3 -1
index 1b6f8f6db7aa..c12f5d8c4bf6 100644
@@ -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:
Signature · 1 line
2.46.0.662.g92d0881bb0-goog
#1 lore raw
Quoted 2 lines · Ian Rogers

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

Quoted 23 lines
---
 tools/perf/util/vdso.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/vdso.c +3 -1
index 1b6f8f6db7aa..c12f5d8c4bf6 100644
@@ -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:
Signature · 1 line
2.46.0.662.g92d0881bb0-goog
author reviewer
#2 lore raw
Quoted 10 lines · Arnaldo Carvalho de Melo
Quoted 2 lines · Ian Rogers

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

author reviewer
#3 lore raw
Quoted 8 lines · Ian Rogers
Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 2 lines · Ian Rogers

If the dso type doesn't match then NULL is returned but the dso should be put first.

Quoted 7 lines
Quoted 5 lines

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

maintainer
#4 lore raw
Quoted 11 lines · Ian Rogers
Quoted 10 lines · Ian Rogers
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 2 lines · Ian Rogers

If the dso type doesn't match then NULL is returned but the dso should be put first.

I guess we can add:

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
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

#5 lore raw
Quoted 14 lines · Namhyung Kim
Quoted 13 lines · Ian Rogers
Quoted 12 lines · Ian Rogers
Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 2 lines · Ian Rogers

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")
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

?

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