Skip to contentSkip to conversation

perf kvm: fix segfault by initializing file_name to NULL

PATCH In review David Ahern 3 participants 5 messages Feb 28, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf kvm: fix segfault by initializing file_name to NULL

Dongsoo reported that perf-kvm was segfaulting. The bug was introduced by commit 3786063 which moved file_name from struct perf_kvm which was initialized on the stack to an uninitialized stack variable. Fix by initializing.

Needs to be applied to 3.7 and 3.8 as well.

Cc Xiao Guangrong <[email protected]>
Cc Dongsoo Nathaniel Kim <[email protected]>
---
 tools/perf/builtin-kvm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-kvm.c +1 -1
index ca3f80e..e55701d 100644
@@ -973,7 +973,7 @@ __cmd_buildid_list(const char *file_name, int argc, const char **argv)
 
 int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
 {
-	const char *file_name;
+	const char *file_name = NULL;
 
 	const struct option kvm_options[] = {
 		OPT_STRING('i', "input", &file_name, "file",
Signature · 1 line
1.7.10.1
#2 lore raw
Quoted 7 lines · Xiao Guangrong
Quoted 5 lines · David Ahern

Dongsoo reported that perf-kvm was segfaulting. The bug was introduced by commit 3786063 which moved file_name from struct perf_kvm which was initialized on the stack to an uninitialized stack variable. Fix by initializing.

Quoted 5 lines
Quoted 1 line

Needs to be applied to 3.7 and 3.8 as well.

David, The bug has already been fixed by by Arnaldo, see:
http://git.kernel.org/?p=virt/kvm/kvm.git;a=commit;h=20914ce5b9e1ef4a35f1f09a2c9c8fb8eb1c4d86

very odd. Arnaldo's latest perf/urgent has the problem -- and no initialized variable. Seems to have been dropped somewhere.

David

#3 lore raw

Em Wed, Feb 27, 2013 at 09:43:31PM -0700, David Ahern escreveu:

Quoted 7 lines · Xiao Guangrong
Quoted 5 lines · David Ahern
Quoted 4 lines

Dongsoo reported that perf-kvm was segfaulting. The bug was introduced by commit 3786063 which moved file_name from struct perf_kvm which was initialized on the stack to an uninitialized stack variable. Fix by initializing.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Needs to be applied to 3.7 and 3.8 as well.

David, The bug has already been fixed by by Arnaldo, see:
http://git.kernel.org/?p=virt/kvm/kvm.git;a=commit;h=20914ce5b9e1ef4a35f1f09a2c9c8fb8eb1c4d86

very odd. Arnaldo's latest perf/urgent has the problem -- and no initialized variable. Seems to have been dropped somewhere.

Just fast forwarded my perf/urgent to tip/perf/urgent, checked and the fix is there as pointed out by Xiao.

- Arnaldo

#4 lore raw
Quoted 2 lines · Arnaldo Carvalho de Melo

Just fast forwarded my perf/urgent to tip/perf/urgent, checked and the fix is there as pointed out by Xiao.

hmm.... hanging out in your perf/core branch rather than perf/urgent.

David