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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140421160655.GA4201@quad>
Date:	Mon, 21 Apr 2014 18:06:55 +0200
From:	Stephane Eranian <eranian@...gle.com>
To:	linux-kernel@...r.kernel.org
Cc:	acme@...hat.com, jolsa@...hat.com, peterz@...radead.org,
	mingo@...e.hu, namhyung@...nel.org, dsahern@...il.com
Subject: [PATCH] perf tools: fix processing of pid/tid for mmap records

perf tools: fix processing of pid/tid for mmap records
    
Mmaps are global to a process (always). Processing them
per-thread was causing some serious issues in case mmaps
would overlap. The overlap fixups would only occur in the
context of the thread which generated the overlapping
mmap. But that was cause issues later on when a sample
from another thread would fall into that overlapping
mmap.

The solution to the problem is to handle ALL mmaps as
occurring in the master thread (pid = tid) and then to
lookup for thread map using pid as the tid argument.
This is how samples are looking up for the thread map
already (notice pid passed twice):
    
int perf_event__preprocess_sample(const union perf_event *event,
                                  struct machine *machine,
                                  struct addr_location *al,
                                  struct perf_sample *sample)
{
        struct thread *thread = machine__findnew_thread(machine, sample->pid,
                                                        sample->pid);
}
    
Without this fix, some samples in overlapping regions
may not be symbolized.
    
Signed-off-by: Stephane Eranian <eranian@...gle.com>

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b..43cdc0a 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1025,9 +1025,9 @@ int machine__process_mmap2_event(struct machine *machine,
 			goto out_problem;
 		return 0;
 	}
-
+	/* only look by pid for mmap events */
 	thread = machine__findnew_thread(machine, event->mmap2.pid,
-					event->mmap2.tid);
+					event->mmap2.pid);
 	if (thread == NULL)
 		goto out_problem;
 
@@ -1073,9 +1073,9 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
 			goto out_problem;
 		return 0;
 	}
-
+	/* only look by pid for mmap events */
 	thread = machine__findnew_thread(machine, event->mmap.pid,
-					 event->mmap.tid);
+					 event->mmap.pid);
 	if (thread == NULL)
 		goto out_problem;
 
--
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