All of lore.kernel.org
 help / color / mirror / Atom feed
* + kprobes-support-probing-module-__exit-function-fix-2.patch added to -mm tree
@ 2008-11-19  7:41 akpm
  2008-11-19 23:02 ` [PATCH -mm] bugfix: release old_p's insn_slot before error return Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2008-11-19  7:41 UTC (permalink / raw)
  To: mm-commits; +Cc: mhiramat, ananth, anil.s.keshavamurthy


The patch titled
     bugfix: pass aggr_kprobe to arch_remove_kprobe
has been added to the -mm tree.  Its filename is
     kprobes-support-probing-module-__exit-function-fix-2.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: bugfix: pass aggr_kprobe to arch_remove_kprobe
From: Masami Hiramatsu <mhiramat@redhat.com>

akpm@linux-foundation.org wrote:
> The patch titled
>      kprobes: support probing module __exit function
> has been added to the -mm tree.  Its filename is
>      kprobes-support-probing-module-__exit-function.patch

Call arch_remove_kprobe() with aggr_kprobe instead of user specific kprobe,
because the user specific kprobe on the gone or reused aggr_kprobe may have
invalid arch_specific_insn.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/kprobes.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff -puN kernel/kprobes.c~kprobes-support-probing-module-__exit-function-fix-2 kernel/kprobes.c
--- a/kernel/kprobes.c~kprobes-support-probing-module-__exit-function-fix-2
+++ a/kernel/kprobes.c
@@ -762,14 +762,14 @@ static void __kprobes __unregister_kprob
 {
 	struct kprobe *old_p;
 
-	if (list_empty(&p->list) || list_is_singular(&p->list)) {
-		if (!list_empty(&p->list)) {
-			/* "p" is the last child of an aggr_kprobe */
-			old_p = list_entry(p->list.next, struct kprobe, list);
-			list_del(&p->list);
-			kfree(old_p);
-		}
+	if (list_empty(&p->list))
 		arch_remove_kprobe(p);
+	else if (list_is_singular(&p->list)) {
+		/* "p" is the last child of an aggr_kprobe */
+		old_p = list_entry(p->list.next, struct kprobe, list);
+		list_del(&p->list);
+		arch_remove_kprobe(old_p);
+		kfree(old_p);
 	}
 }
 
_

Patches currently in -mm which might be from mhiramat@redhat.com are

kprobes-bugfix-try_module_get-even-if-calling_mod-is-null.patch
kprobes-indirectly-call-kprobe_target.patch
kprobes-add-tests-for-register_kprobes.patch
module-add-within_module_core-and-within_module_init.patch
kprobes-add-kprobe_insn_mutex-and-cleanup-arch_remove_kprobe.patch
kprobes-add-__kprobes-to-kprobe-internal-functions.patch
kprobes-support-probing-module-__exit-function.patch
kprobes-support-probing-module-__exit-function-fix.patch
kprobes-support-probing-module-__exit-function-fix-2.patch
kprobes-remove-called_from-argument.patch
kprobes-remove-called_from-argument-fix.patch
module-add-module_state_live-notify.patch
kprobes-support-probing-module-__init-function.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH -mm] bugfix: release old_p's insn_slot before error return
  2008-11-19  7:41 + kprobes-support-probing-module-__exit-function-fix-2.patch added to -mm tree akpm
@ 2008-11-19 23:02 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2008-11-19 23:02 UTC (permalink / raw)
  To: akpm
  Cc: mm-commits, ananth, anil.s.keshavamurthy, Jim Keniston, LKML,
	systemtap-ml

Hi Andrew,

akpm@linux-foundation.org wrote:
> The patch titled
>      bugfix: pass aggr_kprobe to arch_remove_kprobe
> has been added to the -mm tree.  Its filename is
>      kprobes-support-probing-module-__exit-function-fix-2.patch

Oops, sorry, I found one another bug...

Release old_p->ainsn.insn_slot before error return, if the memory
allocation of new aggr_kprobe is failed.

Signed-off-by: Masami Hiramatsu  <mhiramat@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
 kernel/kprobes.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: 2.6.28-rc4/kernel/kprobes.c
===================================================================
--- 2.6.28-rc4.orig/kernel/kprobes.c
+++ 2.6.28-rc4/kernel/kprobes.c
@@ -584,8 +584,11 @@ static int __kprobes register_aggr_kprob
 		ap = old_p;
 	} else {
 		ap = kzalloc(sizeof(struct kprobe), GFP_KERNEL);
-		if (!ap)
+		if (!ap) {
+			if (kprobe_gone(old_p))
+				arch_remove_kprobe(old_p);
 			return -ENOMEM;
+		}
 		add_aggr_kprobe(ap, old_p);
 		copy_kprobe(ap, p);
 		ret = add_new_kprobe(ap, p);


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-19 23:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19  7:41 + kprobes-support-probing-module-__exit-function-fix-2.patch added to -mm tree akpm
2008-11-19 23:02 ` [PATCH -mm] bugfix: release old_p's insn_slot before error return Masami Hiramatsu

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.