lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1340599055-89633-1-git-send-email-dsahern@gmail.com>
Date:	Sun, 24 Jun 2012 22:37:35 -0600
From:	David Ahern <dsahern@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	psuriset@...ux.vnet.ibm.com, David Ahern <dsahern@...il.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH] perf kvm: fix segfault with default guest arguments

File generated with:
$ perf kvm --host --guest --guestkallsyms=/tmp/guest-kallsyms
    --guestmodules=/tmp/guest-modules record -a

The report command:
$ perf kvm --host --guest --guestkallsyms=/tmp/guest-kallsyms
    --guestmodules=/tmp/guest-modules report

dies with a SEGFAULT:
Program received signal SIGSEGV, Segmentation fault.
0x000000000046dd7b in machine__mmap_name (self=0x0, bf=0x7fffffffbd20 "q\021", size=4096) at util/map.c:715
715			snprintf(bf, size, "[%s.%d]", "guest.kernel.kallsyms", self->pid);

(gdb) bt
    at util/event.c:668
    file_offset=8480) at util/session.c:979
    0x7fffffffdd80) at util/session.c:1363

If no samples hit within a guest module then no build id events are written
to the header during the record. On the report side this cases no 'machine'
to be generated for the default guest (pid == 0) leading to a
machine == NULL in perf_session_deliver_event.

perf's handling of default kallsyms and guest-modules needs to be reworked.
Until then perf should at least not segfault.

Reported-by: Pradeep Kumar Surisetty <psuriset@...ux.vnet.ibm.com>
CC: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: David Ahern <dsahern@...il.com>
---
 tools/perf/util/session.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c3e399b..3999d5e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -976,6 +976,8 @@ static int perf_session_deliver_event(struct perf_session *session,
 		}
 		return tool->sample(tool, event, sample, evsel, machine);
 	case PERF_RECORD_MMAP:
+		if (machine == NULL)
+			return 0;
 		return tool->mmap(tool, event, sample, machine);
 	case PERF_RECORD_COMM:
 		return tool->comm(tool, event, sample, machine);
-- 
1.7.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ