+ kprobes-support-probing-module-__exit-function-fix-2.patch added to -mm tree
[email protected]
tree noticeThe 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 <[email protected]>
Quoted 4 lines · [email protected] wrote:
The patch titled
kprobes: support probing module__exitfunction
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.
---
kernel/kprobes.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
kernel/kprobes.c renamed from kernel/kprobes.c~kprobes-support-probing-module-__exit-function-fix-2 +7 -7
@@ -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 [email protected] 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
PATCH 1/1 bugfix: release old_p's insn_slot before error return
Hi Andrew,
Quoted 4 lines · [email protected] wrote:
The patch titled
bugfix: passaggr_kprobetoarch_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.
--- kernel/kprobes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/kprobes.c +4 -1
@@ -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);
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America) Inc. Software Solutions Division e-mail: [email protected]