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
| ||
|
Date: Fri, 21 May 2010 11:28:31 GMT From: tip-bot for Peter Zijlstra <a.p.zijlstra@...llo.nl> To: linux-tip-commits@...r.kernel.org Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, acme@...hat.com, hpa@...or.com, mingo@...hat.com, a.p.zijlstra@...llo.nl, efault@....de, fweisbec@...il.com, rostedt@...dmis.org, tglx@...utronix.de, mingo@...e.hu Subject: [tip:perf/core] perf: Ensure that IOC_OUTPUT isn't used to create multi-writer buffers Commit-ID: 0f139300c9057c16b5833a4636b715b104fe0baa Gitweb: http://git.kernel.org/tip/0f139300c9057c16b5833a4636b715b104fe0baa Author: Peter Zijlstra <a.p.zijlstra@...llo.nl> AuthorDate: Thu, 20 May 2010 14:35:15 +0200 Committer: Ingo Molnar <mingo@...e.hu> CommitDate: Fri, 21 May 2010 11:37:57 +0200 perf: Ensure that IOC_OUTPUT isn't used to create multi-writer buffers Since we want to ensure buffers only have a single writer, we must avoid creating one with multiple. Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl> Cc: Arnaldo Carvalho de Melo <acme@...hat.com> Cc: Frederic Weisbecker <fweisbec@...il.com> Cc: Paul Mackerras <paulus@...ba.org> Cc: Mike Galbraith <efault@....de> Cc: Steven Rostedt <rostedt@...dmis.org> LKML-Reference: <20100521090710.528215873@...llo.nl> Signed-off-by: Ingo Molnar <mingo@...e.hu> --- kernel/perf_event.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 3f2cc31..7a93252 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -4920,6 +4920,13 @@ static int perf_event_set_output(struct perf_event *event, int output_fd) int fput_needed = 0; int ret = -EINVAL; + /* + * Don't allow output of inherited per-task events. This would + * create performance issues due to cross cpu access. + */ + if (event->cpu == -1 && event->attr.inherit) + return -EINVAL; + if (!output_fd) goto set; @@ -4940,6 +4947,18 @@ static int perf_event_set_output(struct perf_event *event, int output_fd) if (event->data) goto out; + /* + * Don't allow cross-cpu buffers + */ + if (output_event->cpu != event->cpu) + goto out; + + /* + * If its not a per-cpu buffer, it must be the same task. + */ + if (output_event->cpu == -1 && output_event->ctx != event->ctx) + goto out; + atomic_long_inc(&output_file->f_count); set: -- 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