mirror of https://gitee.com/openkylin/linux.git
perf/urgent fixes:
. Validate syscall id before growing syscall table in 'trace', fixing potential excessive memory usage. . Validate perf_sample.raw_data, making 'trace' more robust, avoiding some potential SEGFAULTs when reading tracepoint fields. . Fix exclude_guest parse events 'perf test's, from Jiri Olsa. . Do not flush maps on COMM, that is sent by the kernel when a process is exec'ed, but also when a process changes its name. Since we were assuming a COMM always meant an EXEC, we were losing track of a process maps by flushing its maps. Fix from Luigi Semenzato. . A recent patch introduced a problem by not initializing what should be the first kind of pager to use, 'man', instead it was being left as zero which means no pager. This caused 'perf subcmd --help' to produce no output. Fix from Namhyung Kim. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJQhXDoAAoJENZQFvNTUqpAUuwP/3QI4SpPwUBMXxYcc3wSZlf0 qQp2ObUVJ+b9HnhTHek8IDcdAhvFkejQcujrLN1pVS3n402pG0rtLQ3TI3YYYlVr TADaxt6zAmmV6KRfUzUAg2Zzp+wcMTCJbs3XniC3FvPTHchPiVlWR1XKbKFhscrS rKPsjbb9OeQLrXXjs5jODB39B6Gt/ao9eYvIXEYleYbJ5ksNrgljtgHK4zFlcnut I3/RJlZXFZ01CrytbKaIRMws7uJ/JZFbNSqOrPfZTdAfifuBj6r2GEM857pxijUQ y3DTMouQDo3fEwk8QNZ2tF3H1U7qabfkKiWndY3gojphy74eI+eBI14aKZCZj8+E PemmsaGwp72v+QgbDdC+WRqgp4jRwgLDRHtodPD7ebF6ylGDkMuGZHhrgJahLO6O t3w7DNTAn1u6/TpdllB//enCnGgBAi3XRT6IlyB7kLD9Fbno27UUMAEN73EULzbF jfbhM6CdWth9SU0e5nu4+XzPe5XwMIPbA1nRBtYjS54stz26IwHDLEPNNcvV1IcM SQ0UyUHVmTYRUjiS1on5IWiZ8b2UJGH5TtHu+sTYvMrsmM6xYVXNhFJL8vlZWk/m vTdHGdaF0rPRDbWsr/Y9XsCmuWQweXPlihL8uzeXjmY5XDqP+41tnsGCbBYmGcye 05bBrtPff4YzUZA3RQ8s =u/Br -----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: * Validate syscall id before growing syscall table in 'trace', fixing potential excessive memory usage. * Validate perf_sample.raw_data, making 'trace' more robust, avoiding some potential SEGFAULTs when reading tracepoint fields. * Fix exclude_guest parse events 'perf test's, from Jiri Olsa. * Do not flush maps on COMM, that is sent by the kernel when a process is exec'ed, but also when a process changes its name. Since we were assuming a COMM always meant an EXEC, we were losing track of a process maps by flushing its maps. Fix from Luigi Semenzato. * A recent patch introduced a problem by not initializing what should be the first kind of pager to use, 'man', instead it was being left as zero which means no pager. This caused 'perf subcmd --help' to produce no output. Fix from Namhyung Kim. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
c1264a4ab7
|
@ -414,7 +414,7 @@ static int show_html_page(const char *perf_cmd)
|
|||
int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
|
||||
{
|
||||
bool show_all = false;
|
||||
enum help_format help_format = HELP_FORMAT_NONE;
|
||||
enum help_format help_format = HELP_FORMAT_MAN;
|
||||
struct option builtin_help_options[] = {
|
||||
OPT_BOOLEAN('a', "all", &show_all, "print all available commands"),
|
||||
OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN),
|
||||
|
|
|
@ -56,6 +56,10 @@ static int trace__read_syscall_info(struct trace *trace, int id)
|
|||
{
|
||||
char tp_name[128];
|
||||
struct syscall *sc;
|
||||
const char *name = audit_syscall_to_name(id, trace->audit_machine);
|
||||
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
|
||||
if (id > trace->syscalls.max) {
|
||||
struct syscall *nsyscalls = realloc(trace->syscalls.table, (id + 1) * sizeof(*sc));
|
||||
|
@ -75,11 +79,8 @@ static int trace__read_syscall_info(struct trace *trace, int id)
|
|||
}
|
||||
|
||||
sc = trace->syscalls.table + id;
|
||||
sc->name = audit_syscall_to_name(id, trace->audit_machine);
|
||||
if (sc->name == NULL)
|
||||
return -1;
|
||||
|
||||
sc->fmt = syscall_fmt__find(sc->name);
|
||||
sc->name = name;
|
||||
sc->fmt = syscall_fmt__find(sc->name);
|
||||
|
||||
snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name);
|
||||
sc->tp_format = event_format__new("syscalls", tp_name);
|
||||
|
@ -267,6 +268,13 @@ static int trace__run(struct trace *trace)
|
|||
if (evlist->threads->map[0] == -1 || evlist->threads->nr > 1)
|
||||
printf("%d ", sample.tid);
|
||||
|
||||
if (sample.raw_data == NULL) {
|
||||
printf("%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n",
|
||||
perf_evsel__name(evsel), sample.tid,
|
||||
sample.cpu, sample.raw_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
handler = evsel->handler.func;
|
||||
handler(trace, evsel, &sample);
|
||||
}
|
||||
|
|
|
@ -513,7 +513,8 @@ static int test__group1(struct perf_evlist *evlist)
|
|||
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||
/* use of precise requires exclude_guest */
|
||||
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||
TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2);
|
||||
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||
|
@ -599,7 +600,8 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused)
|
|||
TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
|
||||
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
|
||||
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||
/* use of precise requires exclude_guest */
|
||||
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||
TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3);
|
||||
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||
|
@ -662,7 +664,8 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused)
|
|||
TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
|
||||
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
|
||||
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||
/* use of precise requires exclude_guest */
|
||||
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||
TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1);
|
||||
TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
|
||||
|
@ -676,7 +679,8 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused)
|
|||
TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
|
||||
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
|
||||
TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
|
||||
TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
|
||||
/* use of precise requires exclude_guest */
|
||||
TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
|
||||
TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
|
||||
TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2);
|
||||
TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
|
||||
|
|
|
@ -39,7 +39,6 @@ int thread__set_comm(struct thread *self, const char *comm)
|
|||
err = self->comm == NULL ? -ENOMEM : 0;
|
||||
if (!err) {
|
||||
self->comm_set = true;
|
||||
map_groups__flush(&self->mg);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue