Skip to contentSkip to conversation

perf tools: arm-spe: Fix uninitialized record error variable

PATCH In review Kim Phillips 3 participants 4 messages Aug 10, 2018 – Aug 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: arm-spe: Fix uninitialized record error variable

The auxtrace init variable 'err' was not being initialized, leading perf to abort early in an SPE record command when there was no explicit error, rather only based whatever memory contents were on the stack. Initialize it explicitly on getting an SPE successfully, the same way cs-etm does.

---
Hi Arnaldo, please apply to perf/urgent / stable series if at all possible. Thank you.

 tools/perf/arch/arm64/util/arm-spe.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/arch/arm64/util/arm-spe.c +1 -0
index 1120e39c1b00..5ccfce87e693 100644
@@ -194,6 +194,7 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
 	sper->itr.read_finish = arm_spe_read_finish;
 	sper->itr.alignment = 0;
 
+	*err = 0;
 	return &sper->itr;
 }
 
Signature · 1 line
2.17.1
#1 lore raw

Em Fri, Aug 10, 2018 at 05:45:12PM -0500, Kim Phillips escreveu:

Quoted 10 lines

The auxtrace init variable 'err' was not being initialized, leading perf to abort early in an SPE record command when there was no explicit error, rather only based whatever memory contents were on the stack. Initialize it explicitly on getting an SPE successfully, the same way cs-etm does.

---
Hi Arnaldo, please apply to perf/urgent / stable series if at all possible. Thank you.

In such cases the best thing is to have a "Fixes: ..." so that this gets automatically picked by the stabe trees, I'll try to find out what was the patch that introduced this problem.

- Arnaldo

#2 lore raw

Em Mon, Aug 13, 2018 at 03:55:11PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 7 lines

Em Fri, Aug 10, 2018 at 05:45:12PM -0500, Kim Phillips escreveu:

Quoted 6 lines

The auxtrace init variable 'err' was not being initialized, leading perf to abort early in an SPE record command when there was no explicit error, rather only based whatever memory contents were on the stack. Initialize it explicitly on getting an SPE successfully, the same way cs-etm does.

Quoted 8 lines
Quoted 4 lines

---
Hi Arnaldo, please apply to perf/urgent / stable series if at all possible. Thank you.

In such cases the best thing is to have a "Fixes: ..." so that this gets automatically picked by the stabe trees, I'll try to find out what was the patch that introduced this problem.

This one was easy, there is just one cset for this file prior to this fix, so:

Fixes ffd3d18c20b8 ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support")

- Arnaldo

#3 lore raw

[tip:perf/urgent] perf arm spe: Fix uninitialized record error variable

In reply to Kim Phillips
perf arm spe: Fix uninitialized record error variable
Commit-ID:  344353366591acf659a0d0dea498611da78d67e2
Gitweb:     https://git.kernel.org/tip/344353366591acf659a0d0dea498611da78d67e2
Author:     Kim Phillips <[email protected]>
AuthorDate: Fri, 10 Aug 2018 17:45:12 -0500
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 14 Aug 2018 15:10:44 -0300

perf arm spe: Fix uninitialized record error variable

The auxtrace init variable 'err' was not being initialized, leading perf to abort early in an SPE record command when there was no explicit error, rather only based whatever memory contents were on the stack. Initialize it explicitly on getting an SPE successfully, the same way cs-etm does.

Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Dongjiu Geng <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Fixes ffd3d18c20b8 ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support")
---
 tools/perf/arch/arm64/util/arm-spe.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/arch/arm64/util/arm-spe.c +1 -0
index 1120e39c1b00..5ccfce87e693 100644
@@ -194,6 +194,7 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
 	sper->itr.read_finish = arm_spe_read_finish;
 	sper->itr.alignment = 0;
 
+	*err = 0;
 	return &sper->itr;
 }