All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@redhat.com>
Cc: "Naveen N . Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S . Miller" <davem@davemloft.net>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH -tip 5/5] kprobes: Don't call BUG_ON if there is a kprobe in use on free list
Date: Tue, 21 Aug 2018 18:39:58 +0900	[thread overview]
Message-ID: <153484439807.5385.8446592533176849097.stgit@devbox> (raw)
In-Reply-To: <153484425558.5385.1484910606397784412.stgit@devbox>

Instead of calling BUG_ON, if we find a kprobe in use on free kprobe
list, just remove it from the list and keep it on kprobe hash list
as same as other in-use kprobes.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/kprobes.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 63c342e5e6c3..e3420364b415 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -546,8 +546,14 @@ static void do_free_cleaned_kprobes(void)
 	struct optimized_kprobe *op, *tmp;
 
 	list_for_each_entry_safe(op, tmp, &freeing_list, list) {
-		BUG_ON(!kprobe_unused(&op->kp));
 		list_del_init(&op->list);
+		if (!kprobe_unused(&op->kp)) {
+			/*
+			 * This must not happen, but if there is a kprobe
+			 * still in use, keep it on kprobes hash list.
+			 */
+			continue;
+		}
 		free_aggr_kprobe(&op->kp);
 	}
 }


  parent reply	other threads:[~2018-08-21  9:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  9:37 [PATCH -tip 0/5] kprobes: Remove BUG_ON from kprobes Masami Hiramatsu
2018-08-21  9:38 ` [PATCH -tip 1/5] kprobes: Remove meaningless BUG_ON from disarming process Masami Hiramatsu
2018-08-21  9:38 ` [PATCH -tip 2/5] kprobes: Remove meaningless BUG_ON from add_new_kprobe Masami Hiramatsu
2018-08-21  9:39 ` [PATCH -tip 3/5] kprobes: Remove meaningless BUG_ON from reuse_unused_kprobe Masami Hiramatsu
2018-08-21  9:39 ` [PATCH -tip 4/5] kprobes: Return error if fail to reuse kprobe instead of BUG_ON Masami Hiramatsu
2018-08-21  9:39 ` Masami Hiramatsu [this message]
2018-09-10 12:23   ` [PATCH -tip 5/5] kprobes: Don't call BUG_ON if there is a kprobe in use on free list Ingo Molnar
2018-09-11  6:36     ` Masami Hiramatsu

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=153484439807.5385.8446592533176849097.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.vnet.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.