mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 08:02:07 +00:00
perf/urgent fixes:
. Fix up /proc/PID/maps parsing, where perfectly fine mmap entries were being trown away when synthesizing PERF_RECORD_MMAP for preexisting threads, prevenging symbol resolution to work for those threads, broken in the MMAP2 removal. Reported and pinpointed by Markus Trippelsdorf, . Fix mem leak in the python 'perf script' backend, due to missing Py_DECREFs on dict entries, fix from Joseph Schuchart. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAABAgAGBQJSbnfHAAoJENZQFvNTUqpA66kQAJUcIBvn72kmZXmw5wf0eroL xBsgInu9rUoP1BVlaG2HVY9Sx8z9qi0bJM01UxLPypAfJD0yho4iKsnuW0u8GtMi Ha+F7DQsWA0aspuRUVA/39ylwV+mcuu0isNdMm85xWxYB7XK6n7fyClbhqkLP+Y1 YPRsEN6H+/ZVveBeZkmh2+c/KQgIBYOQcZ2EtpCOv8Je3sgqNrXoPKmrgORvOVN5 hQg6M+VdcXtcnJ/MxlmKxUxHGTwAWRkl0GNcmYhWfULsogCX948zAAfju7+jHMbj RbciiaZHLa1AtArEa7OU3F0HAFqPm16T3IH848vNPoaj7Y/t349f3mTt2aloKGxb qt8uKSDgyZ9DeHLHMqcATh5GqV7UdmntXf8nSYFhwHfcqseAlw3DNsnU+aLx1Rrx iFyq7K9ADcBLYUdFn0LPZiwqpvDNutC1OZZQgtqxQfc/WYIlmBSlAyXr/jCa8kD7 HrIeVGfI23bVKnoQjTgMMlR3lkNseiiCpPWtYFXk7YFPPVFTIGHb0ex20U83Ipbf G4tL5CEG19FPzpC/C6NDcq9sthaDnzV2DS6hU+IUxdSgUUXaHOu4lVRUjC0ZPQ/M apnWtrf38dLG72oFPWrY9fe+tGs7/BMYub2FPfqwdWHBa04J2LcFtKGxSZFTDaWN eziDrrvFGOguKOh+KcHV =/kKq -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Pull perf/urgent fixes from Arnaldo Carvalho de Melo: * Fix up /proc/PID/maps parsing, where perfectly fine mmap entries were being trown away when synthesizing PERF_RECORD_MMAP for preexisting threads, prevenging symbol resolution to work for those threads, broken in the MMAP2 removal. Reported and pinpointed by Markus Trippelsdorf, * Fix mem leak in the python 'perf script' backend, due to missing Py_DECREFs on dict entries, fix from Joseph Schuchart. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
d17cccbea9
@ -213,7 +213,7 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
|
||||
&event->mmap.pgoff,
|
||||
execname);
|
||||
|
||||
if (n != 8)
|
||||
if (n != 5)
|
||||
continue;
|
||||
|
||||
if (prot[2] != 'x')
|
||||
|
@ -56,6 +56,17 @@ static void handler_call_die(const char *handler_name)
|
||||
Py_FatalError("problem in Python trace event handler");
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert val into into the dictionary and decrement the reference counter.
|
||||
* This is necessary for dictionaries since PyDict_SetItemString() does not
|
||||
* steal a reference, as opposed to PyTuple_SetItem().
|
||||
*/
|
||||
static void pydict_set_item_string_decref(PyObject *dict, const char *key, PyObject *val)
|
||||
{
|
||||
PyDict_SetItemString(dict, key, val);
|
||||
Py_DECREF(val);
|
||||
}
|
||||
|
||||
static void define_value(enum print_arg_type field_type,
|
||||
const char *ev_name,
|
||||
const char *field_name,
|
||||
@ -279,11 +290,11 @@ static void python_process_tracepoint(union perf_event *perf_event
|
||||
PyTuple_SetItem(t, n++, PyInt_FromLong(pid));
|
||||
PyTuple_SetItem(t, n++, PyString_FromString(comm));
|
||||
} else {
|
||||
PyDict_SetItemString(dict, "common_cpu", PyInt_FromLong(cpu));
|
||||
PyDict_SetItemString(dict, "common_s", PyInt_FromLong(s));
|
||||
PyDict_SetItemString(dict, "common_ns", PyInt_FromLong(ns));
|
||||
PyDict_SetItemString(dict, "common_pid", PyInt_FromLong(pid));
|
||||
PyDict_SetItemString(dict, "common_comm", PyString_FromString(comm));
|
||||
pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu));
|
||||
pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s));
|
||||
pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns));
|
||||
pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid));
|
||||
pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm));
|
||||
}
|
||||
for (field = event->format.fields; field; field = field->next) {
|
||||
if (field->flags & FIELD_IS_STRING) {
|
||||
@ -313,7 +324,7 @@ static void python_process_tracepoint(union perf_event *perf_event
|
||||
if (handler)
|
||||
PyTuple_SetItem(t, n++, obj);
|
||||
else
|
||||
PyDict_SetItemString(dict, field->name, obj);
|
||||
pydict_set_item_string_decref(dict, field->name, obj);
|
||||
|
||||
}
|
||||
if (!handler)
|
||||
@ -370,21 +381,21 @@ static void python_process_general_event(union perf_event *perf_event
|
||||
if (!handler || !PyCallable_Check(handler))
|
||||
goto exit;
|
||||
|
||||
PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
|
||||
PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize(
|
||||
pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel)));
|
||||
pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize(
|
||||
(const char *)&evsel->attr, sizeof(evsel->attr)));
|
||||
PyDict_SetItemString(dict, "sample", PyString_FromStringAndSize(
|
||||
pydict_set_item_string_decref(dict, "sample", PyString_FromStringAndSize(
|
||||
(const char *)sample, sizeof(*sample)));
|
||||
PyDict_SetItemString(dict, "raw_buf", PyString_FromStringAndSize(
|
||||
pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize(
|
||||
(const char *)sample->raw_data, sample->raw_size));
|
||||
PyDict_SetItemString(dict, "comm",
|
||||
pydict_set_item_string_decref(dict, "comm",
|
||||
PyString_FromString(thread->comm));
|
||||
if (al->map) {
|
||||
PyDict_SetItemString(dict, "dso",
|
||||
pydict_set_item_string_decref(dict, "dso",
|
||||
PyString_FromString(al->map->dso->name));
|
||||
}
|
||||
if (al->sym) {
|
||||
PyDict_SetItemString(dict, "symbol",
|
||||
pydict_set_item_string_decref(dict, "symbol",
|
||||
PyString_FromString(al->sym->name));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user