From db93c0857fda63f531a88db852499e44fc37d63d Mon Sep 17 00:00:00 2001 From: Cheng Jian Date: Fri, 8 Mar 2019 15:35:49 +0800 Subject: [PATCH] Revert "perf: Paper over the hw.target problems" euler inclusion category: bugfix bugzilla: 9513/11006 CVE: NA -------------------------------------------------- This reverts commit b772baf9a14ab4975e8884a399a4e0bab2fb6bf9. we merge the patch b772baf9a14a ("perf: Paper over the hw.target problems") to reslove an use-after-free issue (bugzilla #9513/#11006). but it cause some new problem (bugzilla #11050/#11049) in this version. So just revert it. Signed-off-by: Cheng Jian Reviewed-by: Xie XiuQi Signed-off-by: Yang Yingliang --- kernel/events/core.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 2593545323dd..f47fcac5bba2 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -2104,27 +2104,6 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla event_function_call(event, __perf_remove_from_context, (void *)flags); - /* - * This is as passable as any hw.target handling out there; - * hw.target implies task context, therefore, no migration. - * Which means that we can only get here at the teardown. - */ - if (event->hw.target) { - /* - * Now, the problem with, say uprobes, is that they - * use hw.target for context in their ->destroy() - * callbacks. Supposedly, they may need to poke at - * its contents, so better call it while we still - * have the task. - */ - if (event->destroy) { - event->destroy(event); - event->destroy = NULL; - } - put_task_struct(event->hw.target); - event->hw.target = NULL; - } - /* * The above event_function_call() can NO-OP when it hits * TASK_TOMBSTONE. In that case we must already have been detached -- GitLab