All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@163.com>
To: naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net, mhiramat@kernel.org
Cc: linux-kernel@vger.kernel.org, liq3ea@gmail.com,
	Li Qiang <liq3ea@163.com>
Subject: [PATCH] kprobe: reverse kp->flags when arm_kprobe failed
Date: Fri,  2 Sep 2022 08:58:20 -0700	[thread overview]
Message-ID: <20220902155820.34755-1-liq3ea@163.com> (raw)

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.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 kernel/kprobes.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 08350e35a..333454df5 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2424,8 +2424,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.25.1


             reply	other threads:[~2022-09-02 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 15:58 Li Qiang [this message]
2022-09-08  4:51 ` [PATCH] kprobe: reverse kp->flags when arm_kprobe failed Li Qiang
2022-09-09 13:07 ` Masami Hiramatsu
2022-09-15  7:04   ` Li Qiang
2022-09-27  2:07 ` Li Qiang

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=20220902155820.34755-1-liq3ea@163.com \
    --to=liq3ea@163.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liq3ea@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.