[kernel] r19760 - in dists/sid/linux-tools/debian: . patches

Ben Hutchings benh at alioth.debian.org
Mon Jan 21 00:03:21 UTC 2013


Author: benh
Date: Mon Jan 21 00:03:21 2013
New Revision: 19760

Log:
perf evlist: Fix errno value reporting on failed mmap (Closes: #696957)

Added:
   dists/sid/linux-tools/debian/patches/perf-evlist-Fix-errno-value-reporting-on-failed-mmap.patch
Modified:
   dists/sid/linux-tools/debian/changelog
   dists/sid/linux-tools/debian/patches/series

Modified: dists/sid/linux-tools/debian/changelog
==============================================================================
--- dists/sid/linux-tools/debian/changelog	Sun Jan 20 17:06:30 2013	(r19759)
+++ dists/sid/linux-tools/debian/changelog	Mon Jan 21 00:03:21 2013	(r19760)
@@ -1,3 +1,9 @@
+linux-tools (3.2.17-2) UNRELEASED; urgency=low
+
+  * perf evlist: Fix errno value reporting on failed mmap (Closes: #696957)
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Sun, 20 Jan 2013 15:42:26 +0000
+
 linux-tools (3.2.17-1) unstable; urgency=low
 
   * New upstream stable updates:

Added: dists/sid/linux-tools/debian/patches/perf-evlist-Fix-errno-value-reporting-on-failed-mmap.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-tools/debian/patches/perf-evlist-Fix-errno-value-reporting-on-failed-mmap.patch	Mon Jan 21 00:03:21 2013	(r19760)
@@ -0,0 +1,41 @@
+From: Nelson Elhage <nelhage at nelhage.com>
+Date: Mon, 19 Dec 2011 08:39:30 -0500
+Subject: perf evlist: Fix errno value reporting on failed mmap
+
+commit 301b195db179241da8be25f345f3c4e64960f1d5 upstream.
+
+On failure, perf_evlist__mmap_per_{cpu,thread} will try to munmap()
+every map that doesn't have a NULL base. This will fail with EINVAL if
+one of them has base == MAP_FAILED, clobbering errno, so that
+perf_evlist__map will return EINVAL on any failure regardless of the
+root cause.
+
+Fix this by resetting failed maps to a NULL base.
+
+Acked-by: Namhyung Kim <namhyung at gmail.com>
+Cc: Ingo Molnar <mingo at elte.hu>
+Cc: Paul Mackerras <paulus at samba.org>
+Cc: Peter Zijlstra <a.p.zijlstra at chello.nl>
+Link: http://lkml.kernel.org/r/1324301972-22740-2-git-send-email-nelhage@nelhage.com
+Signed-off-by: Nelson Elhage <nelhage at nelhage.com>
+Signed-off-by: Arnaldo Carvalho de Melo <acme at redhat.com>
+---
+ tools/perf/util/evlist.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
+index 8b19e7a..963d63d 100644
+--- a/tools/perf/util/evlist.c
++++ b/tools/perf/util/evlist.c
+@@ -447,8 +447,10 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist,
+ 	evlist->mmap[idx].mask = mask;
+ 	evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot,
+ 				      MAP_SHARED, fd, 0);
+-	if (evlist->mmap[idx].base == MAP_FAILED)
++	if (evlist->mmap[idx].base == MAP_FAILED) {
++		evlist->mmap[idx].base = NULL;
+ 		return -1;
++	}
+ 
+ 	perf_evlist__add_pollfd(evlist, fd);
+ 	return 0;

Modified: dists/sid/linux-tools/debian/patches/series
==============================================================================
--- dists/sid/linux-tools/debian/patches/series	Sun Jan 20 17:06:30 2013	(r19759)
+++ dists/sid/linux-tools/debian/patches/series	Mon Jan 21 00:03:21 2013	(r19760)
@@ -4,3 +4,4 @@
 usbip-update-man-pages.patch
 usbip-fix-explicit-configure-with-tcp-wrappers.patch
 usbip-document-tcp-wrappers.patch
+perf-evlist-Fix-errno-value-reporting-on-failed-mmap.patch



More information about the Kernel-svn-changes mailing list