[PATCH OLK-6.6 0/2] Fix livepatch and kretprobe conflict warning
This series is going to fix livepatch and kretprobe conflict warning. The livepatch has stop_machine() to avoid race condition of tsk->on_cpu state check. It's ok to replace task_is_running to tsk->on_cpu. Kui-Feng Lee (1): rethook: Remove warning messages printed for finding return address of a frame. Tengda Wu (1): rethook: Use tsk->on_cpu to check task execution state kernel/trace/rethook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.34.1
From: Kui-Feng Lee <thinker.li@gmail.com> mainline inclusion from mainline-v6.10-rc1 commit 5120d167e21c674afd0630c65e7f6a00fa0667f1 category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/9357 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- The function rethook_find_ret_addr() prints a warning message and returns 0 when the target task is running and is not the "current" task in order to prevent the incorrect return address, although it still may return an incorrect address. However, the warning message turns into noise when BPF profiling programs call bpf_get_task_stack() on running tasks in a firm with a large number of hosts. The callers should be aware and willing to take the risk of receiving an incorrect return address from a task that is currently running other than the "current" one. A warning is not needed here as the callers are intent on it. Link: https://lore.kernel.org/all/20240408175140.60223-1-thinker.li@gmail.com/ Acked-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Tengda Wu <wutengda2@huawei.com> --- kernel/trace/rethook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/rethook.c b/kernel/trace/rethook.c index 3cebcbaf35a4..e34f322f334e 100644 --- a/kernel/trace/rethook.c +++ b/kernel/trace/rethook.c @@ -260,7 +260,7 @@ unsigned long rethook_find_ret_addr(struct task_struct *tsk, unsigned long frame if (WARN_ON_ONCE(!cur)) return 0; - if (WARN_ON_ONCE(tsk != current && task_is_running(tsk))) + if (tsk != current && task_is_running(tsk)) return 0; do { -- 2.34.1
From: Tengda Wu <wutengda@huaweicloud.com> maillist inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/9357 Reference: https://lore.kernel.org/all/20260525132253.1889726-1-wutengda@huaweicloud.co... ------------------------------------------- When a task calls schedule() to yield the CPU, its state remains TASK_RUNNING, but its stack is frozen and safe to walk. Replace task_is_running(tsk) with tsk->on_cpu to avoid overly conservative rejections. Fixes: 54ecbe6f1ed5 ("rethook: Add a generic return hook") Signed-off-by: Tengda Wu <wutengda@huaweicloud.com> Signed-off-by: Tengda Wu <wutengda2@huawei.com> --- kernel/trace/rethook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/rethook.c b/kernel/trace/rethook.c index e34f322f334e..530ab6faf716 100644 --- a/kernel/trace/rethook.c +++ b/kernel/trace/rethook.c @@ -260,7 +260,7 @@ unsigned long rethook_find_ret_addr(struct task_struct *tsk, unsigned long frame if (WARN_ON_ONCE(!cur)) return 0; - if (tsk != current && task_is_running(tsk)) + if (tsk != current && tsk->on_cpu) return 0; do { -- 2.34.1
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/23764 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/XRS... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/23764 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/XRS...
participants (2)
-
patchwork bot -
Tengda Wu