diff options
Diffstat (limited to 'kernel/events/callchain.c')
-rw-r--r-- | kernel/events/callchain.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c index 6581a040f399..98d4597f43d6 100644 --- a/kernel/events/callchain.c +++ b/kernel/events/callchain.c | |||
@@ -153,7 +153,8 @@ put_callchain_entry(int rctx) | |||
153 | put_recursion_context(__get_cpu_var(callchain_recursion), rctx); | 153 | put_recursion_context(__get_cpu_var(callchain_recursion), rctx); |
154 | } | 154 | } |
155 | 155 | ||
156 | struct perf_callchain_entry *perf_callchain(struct pt_regs *regs) | 156 | struct perf_callchain_entry * |
157 | perf_callchain(struct perf_event *event, struct pt_regs *regs) | ||
157 | { | 158 | { |
158 | int rctx; | 159 | int rctx; |
159 | struct perf_callchain_entry *entry; | 160 | struct perf_callchain_entry *entry; |
@@ -178,6 +179,12 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs) | |||
178 | } | 179 | } |
179 | 180 | ||
180 | if (regs) { | 181 | if (regs) { |
182 | /* | ||
183 | * Disallow cross-task user callchains. | ||
184 | */ | ||
185 | if (event->ctx->task && event->ctx->task != current) | ||
186 | goto exit_put; | ||
187 | |||
181 | perf_callchain_store(entry, PERF_CONTEXT_USER); | 188 | perf_callchain_store(entry, PERF_CONTEXT_USER); |
182 | perf_callchain_user(entry, regs); | 189 | perf_callchain_user(entry, regs); |
183 | } | 190 | } |