From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org, Li Qiang <liq3ea@163.com>
Subject: [for-linus][PATCH 3/6] kprobe: reverse kp->flags when arm_kprobe failed
Date: Sat, 05 Nov 2022 16:50:52 -0400 [thread overview]
Message-ID: <20221105205137.723843386@goodmis.org> (raw)
In-Reply-To: 20221105205049.462806482@goodmis.org
From: Li Qiang <liq3ea@163.com>
In aggregate kprobe case, when arm_kprobe failed,
we need set the kp->flags with KPROBE_FLAG_DISABLED again.
If not, the 'kp' kprobe will been considered as enabled
but it actually not enabled.
Link: https://lore.kernel.org/all/20220902155820.34755-1-liq3ea@163.com/
Fixes: 12310e343755 ("kprobes: Propagate error from arm_kprobe_ftrace()")
Cc: stable@vger.kernel.org
Signed-off-by: Li Qiang <liq3ea@163.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/kprobes.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 3220b0a2fb4a..cd9f5a66a690 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2429,8 +2429,11 @@ int enable_kprobe(struct kprobe *kp)
if (!kprobes_all_disarmed && kprobe_disabled(p)) {
p->flags &= ~KPROBE_FLAG_DISABLED;
ret = arm_kprobe(p);
- if (ret)
+ if (ret) {
p->flags |= KPROBE_FLAG_DISABLED;
+ if (p != kp)
+ kp->flags |= KPROBE_FLAG_DISABLED;
+ }
}
out:
mutex_unlock(&kprobe_mutex);
--
2.35.1
next prev parent reply other threads:[~2022-11-05 20:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 20:50 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 1/6] ring-buffer: Check for NULL cpu_buffer in ring_buffer_wake_waiters() Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 2/6] ftrace: Fix use-after-free for dynamic ftrace_ops Steven Rostedt
2022-11-05 20:50 ` Steven Rostedt [this message]
2022-11-05 20:50 ` [for-linus][PATCH 4/6] fprobe: Check rethook_alloc() return in rethook initialization Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 5/6] tracing/fprobe: Fix to check whether fprobe is registered correctly Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 6/6] tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221105205137.723843386@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liq3ea@163.com \
--cc=mhiramat@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox