]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Mar 2017 08:42:19 +0000 (09:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Mar 2017 08:42:19 +0000 (09:42 +0100)
added patches:
perf-core-fix-event-inheritance-on-fork.patch

queue-4.4/perf-core-fix-event-inheritance-on-fork.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/perf-core-fix-event-inheritance-on-fork.patch b/queue-4.4/perf-core-fix-event-inheritance-on-fork.patch
new file mode 100644 (file)
index 0000000..9f73af4
--- /dev/null
@@ -0,0 +1,66 @@
+From e7cc4865f0f31698ef2f7aac01a50e78968985b7 Mon Sep 17 00:00:00 2001
+From: Peter Zijlstra <peterz@infradead.org>
+Date: Thu, 16 Mar 2017 13:47:49 +0100
+Subject: perf/core: Fix event inheritance on fork()
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+commit e7cc4865f0f31698ef2f7aac01a50e78968985b7 upstream.
+
+While hunting for clues to a use-after-free, Oleg spotted that
+perf_event_init_context() can loose an error value with the result
+that fork() can succeed even though we did not fully inherit the perf
+event context.
+
+Spotted-by: Oleg Nesterov <oleg@redhat.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
+Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Cc: Frederic Weisbecker <fweisbec@gmail.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Stephane Eranian <eranian@google.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Vince Weaver <vincent.weaver@maine.edu>
+Cc: oleg@redhat.com
+Fixes: 889ff0150661 ("perf/core: Split context's event group list into pinned and non-pinned lists")
+Link: http://lkml.kernel.org/r/20170316125823.190342547@infradead.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/events/core.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -9230,7 +9230,7 @@ static int perf_event_init_context(struc
+               ret = inherit_task_group(event, parent, parent_ctx,
+                                        child, ctxn, &inherited_all);
+               if (ret)
+-                      break;
++                      goto out_unlock;
+       }
+       /*
+@@ -9246,7 +9246,7 @@ static int perf_event_init_context(struc
+               ret = inherit_task_group(event, parent, parent_ctx,
+                                        child, ctxn, &inherited_all);
+               if (ret)
+-                      break;
++                      goto out_unlock;
+       }
+       raw_spin_lock_irqsave(&parent_ctx->lock, flags);
+@@ -9274,6 +9274,7 @@ static int perf_event_init_context(struc
+       }
+       raw_spin_unlock_irqrestore(&parent_ctx->lock, flags);
++out_unlock:
+       mutex_unlock(&parent_ctx->mutex);
+       perf_unpin_context(parent_ctx);
index 2ebd9d49a66d4334dbbe969abc545bbd94bf9249..ac57cd242a9d2f26bb1bcab0ce3db9b3ac5ef3cc 100644 (file)
@@ -16,3 +16,4 @@ tpm_tis-use-devm_free_irq-not-free_irq.patch
 hv_netvsc-use-skb_get_hash-instead-of-a-homegrown-implementation.patch
 kernek-fork.c-allocate-idle-task-for-a-cpu-always-on-its-local-node.patch
 give-up-on-gcc-ilog2-constant-optimizations.patch
+perf-core-fix-event-inheritance-on-fork.patch