提交 0eba1f6e 编写于 作者: Y Yang Jihong 提交者: Yongqiang Liu

Revert "perf: Paper over the hw.target problems"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I53VHE
CVE: NA

--------------------------------

This reverts commit 03804742.

This patch is used to solve race between close() and fork() of the perf.
However, this patch is not accepted by the community. As a result,
destory interface is incorrectly invoked during the perf_remove_from_context,
causing UAF, see https://lkml.org/lkml/2019/6/28/856.

For 4.19 kernel, he final fix patch has been incorporated, see eb41044b.
Therefore, need to revert the patch.
Signed-off-by: NYang Jihong <yangjihong1@huawei.com>
Reviewed-by: NKuohai Xu <xukuohai@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 98802b10
...@@ -2135,28 +2135,6 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla ...@@ -2135,28 +2135,6 @@ static void perf_remove_from_context(struct perf_event *event, unsigned long fla
event_function_call(event, __perf_remove_from_context, (void *)flags); 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 together with DETACH_GROUP means that this is the
* final remove_from_context of a task event.
*/
if (event->hw.target && (flags & DETACH_GROUP)) {
/*
* 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 * The above event_function_call() can NO-OP when it hits
* TASK_TOMBSTONE. In that case we must already have been detached * TASK_TOMBSTONE. In that case we must already have been detached
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册