From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, anil.s.keshavamurthy@intel.com,
prasanna@in.ibm.com, jkenisto@us.ibm.com
Subject: [PATCH] kprobes: fix race in unregister_kprobe()
Date: Thu, 1 Dec 2005 14:06:14 +0530 [thread overview]
Message-ID: <20051201083614.GA6513@in.ibm.com> (raw)
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
On architectures which have no-execute support, we use a
module_alloc()ed scratch area to store the kprobed instruction
for out-of-line single-stepping. This instruction slot is
released during unregister_kprobe().
We are currently releasing the slot before synchronize_sched()
would return, leading to a potential reuse of the slot by
another kprobe before the current references are released.
Small patch to fix that condition.
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Acked-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
---
kernel/kprobes.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6.15-rc3/kernel/kprobes.c
===================================================================
--- linux-2.6.15-rc3.orig/kernel/kprobes.c
+++ linux-2.6.15-rc3/kernel/kprobes.c
@@ -436,7 +436,6 @@ static inline void cleanup_kprobe(struct
arch_disarm_kprobe(p);
hlist_del_rcu(&p->hlist);
spin_unlock_irqrestore(&kprobe_lock, flags);
- arch_remove_kprobe(p);
}
static inline void cleanup_aggr_kprobe(struct kprobe *old_p,
@@ -506,6 +505,8 @@ void __kprobes unregister_kprobe(struct
cleanup_kprobe(p, flags);
synchronize_sched();
+ arch_remove_kprobe(p);
+
if (old_p->pre_handler == aggr_pre_handler &&
list_empty(&old_p->list))
kfree(old_p);
reply other threads:[~2005-12-01 8:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20051201083614.GA6513@in.ibm.com \
--to=ananth@in.ibm.com \
--cc=akpm@osdl.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=prasanna@in.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox